Skip to content

Commit 52e7897

Browse files
authored
Neaten logger-init code (#196)
1 parent 5b00c6d commit 52e7897

File tree

3 files changed

+12
-24
lines changed

3 files changed

+12
-24
lines changed

apis/python/examples/uniformizer.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,10 @@ def main() -> int:
5151
args = parser.parse_args()
5252

5353
if args.verbose:
54-
# tiledbsc.logging.logger.setLevel(logging.INFO)
55-
# logger = logging.getLogger('tiledbsc')
56-
# logger.setLevel(logging.INFO)
57-
# logging.getLogger("tiledbsc").setLevel(logging.INFO)
58-
# Not able to get any of the above to 'stick'. The following sets level for the whole app,
59-
# not just the tiledbsc library, but that's an acceptable workaround since this CLI does
60-
# nothing except invoke the tiledbsc library.
61-
logging.basicConfig(level=logging.INFO)
54+
tiledbsc.logging.logger.setLevel(logging.INFO)
55+
logger = logging.getLogger("tiledbsc")
56+
logger.setLevel(logging.INFO)
57+
logger.addHandler(logging.StreamHandler())
6258

6359
uniformizer = Uniformizer(
6460
atlas_uri=args.atlas_uri,

apis/python/tools/ingestor

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,10 @@ select `relative=True`. (This is the default.)
100100
write_soco = args.soco
101101
verbose = not args.quiet
102102
if verbose:
103-
# tiledbsc.logging.logger.setLevel(logging.INFO)
104-
# logger = logging.getLogger('tiledbsc')
105-
# logger.setLevel(logging.INFO)
106-
# logging.getLogger("tiledbsc").setLevel(logging.INFO)
107-
# Not able to get any of the above to 'stick'. The following sets level for the whole app,
108-
# not just the tiledbsc library, but that's an acceptable workaround since this CLI does
109-
# nothing except invoke the tiledbsc library.
110-
logging.basicConfig(level=logging.INFO)
103+
tiledbsc.logging.logger.setLevel(logging.INFO)
104+
logger = logging.getLogger("tiledbsc")
105+
logger.setLevel(logging.INFO)
106+
logger.addHandler(logging.StreamHandler())
111107

112108
if args.relative is not None:
113109
relative = args.relative[0]

apis/python/tools/outgestor

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,10 @@ def main():
7878

7979
verbose = not args.quiet
8080
if verbose:
81-
# tiledbsc.logging.logger.setLevel(logging.INFO)
82-
# logger = logging.getLogger('tiledbsc')
83-
# logger.setLevel(logging.INFO)
84-
# logging.getLogger("tiledbsc").setLevel(logging.INFO)
85-
# Not able to get any of the above to 'stick'. The following sets level for the whole app,
86-
# not just the tiledbsc library, but that's an acceptable workaround since this CLI does
87-
# nothing except invoke the tiledbsc library.
88-
logging.basicConfig(level=logging.INFO)
81+
tiledbsc.logging.logger.setLevel(logging.INFO)
82+
logger = logging.getLogger("tiledbsc")
83+
logger.setLevel(logging.INFO)
84+
logger.addHandler(logging.StreamHandler())
8985

9086
soma = tiledbsc.SOMA(input_path)
9187
tiledbsc.io.to_h5ad(soma, output_path)

0 commit comments

Comments
 (0)