Skip to content

Commit

Permalink
Merge pull request #523 from dandi/fix-file-filter
Browse files Browse the repository at this point in the history
Better filtering of file-only log messages
  • Loading branch information
yarikoptic authored Mar 29, 2021
2 parents 0e63181 + 21f0a10 commit f9843e8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions dandi/cli/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def main(ctx, log_level, pdb=False):
# console:
root = logging.getLogger()
for h in root.handlers:
h.addFilter(lambda r: not r.msg.startswith("[META]"))
h.addFilter(lambda r: not getattr(r, "file_only", False))

logdir = appdirs.user_log_dir("dandi-cli", "dandi")
logfile = os.path.join(
Expand All @@ -106,8 +106,8 @@ def main(ctx, log_level, pdb=False):
handler.setFormatter(fmter)
root.addHandler(handler)

lgr.info("[META] sys.argv = %r", sys.argv)
lgr.info("[META] os.getcwd() = %s", os.getcwd())
lgr.info("sys.argv = %r", sys.argv, extra={"file_only": True})
lgr.info("os.getcwd() = %s", os.getcwd(), extra={"file_only": True})

ctx.obj = SimpleNamespace(logfile=logfile)

Expand Down

0 comments on commit f9843e8

Please sign in to comment.