Skip to content

Commit

Permalink
set debugging level to DEBUG conditionally
Browse files Browse the repository at this point in the history
  • Loading branch information
jacksonjacobs1 committed May 21, 2024
1 parent c75c89a commit c5f34a9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion histoqc/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def main(argv=None):
# --- create output directory and move log --------------------------------
args.outdir = os.path.expanduser(args.outdir)
os.makedirs(args.outdir, exist_ok=True)
move_logging_file_handler(logging.getLogger(), args.outdir)
move_logging_file_handler(logging.getLogger(), args.outdir, args.debug)

if BatchedResultFile.results_in_path(args.outdir):
if args.force:
Expand Down
4 changes: 2 additions & 2 deletions histoqc/_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def setup_logging(*, capture_warnings, filter_warnings):
logging.captureWarnings(capture_warnings)


def move_logging_file_handler(logger, destination):
def move_logging_file_handler(logger, destination, debug=False):
"""point the logging file handlers to the new destination
Parameters
Expand All @@ -94,7 +94,7 @@ def move_logging_file_handler(logger, destination):
new_filename = shutil.move(handler.baseFilename, destination)

new_handler = logging.FileHandler(new_filename, mode='a')
new_handler.setLevel(handler.level)
new_handler.setLevel(logging.DEBUG if debug else handler.level)
new_handler.setFormatter(handler.formatter)
logger.addHandler(new_handler)

Expand Down

0 comments on commit c5f34a9

Please sign in to comment.