Skip to content

Commit

Permalink
fixup! Add tests for destination log level filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
KrystalDelusion committed Mar 25, 2024
1 parent 0c8e21e commit 8b2e28a
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions tests/task_loop/test_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,13 @@ def main():
tl.logging.start_logging(file=log_output1, destination_label="1")
tl.logging.start_logging(file=log_output2, destination_label="2")

tl.LogContext.levels["2"] = "debug"
tl.LogContext.dest_levels["2"] = "debug"
tl.log_debug("line 1")
tl.log("line 2")

del tl.LogContext.levels["2"]
del tl.LogContext.dest_levels["2"]
tl.LogContext.level = "debug"
tl.LogContext.levels["1"] = "info"
tl.LogContext.dest_levels["1"] = "info"
tl.log_debug("line 3")
tl.log("line 4")

Expand Down Expand Up @@ -183,17 +183,18 @@ def main():
tl.logging.start_logging(file=log_output1)
tl.logging.start_logging(file=log_output2, destination_label="2")

# implicit tl.LogContext.level = "info"
tl.LogContext.levels["2"] = "debug"
# tl.LogContext.level = "info" # implied
tl.LogContext.dest_levels["2"] = "debug"
tl.log_debug("line 1")
tl.log("line 2")

tl.LogContext.level = "debug"
tl.LogContext.levels["1"] = "info"
tl.LogContext.levels["2"] = "warning"
tl.LogContext.dest_levels["1"] = "info"
tl.LogContext.dest_levels["2"] = "warning"
tl.log_debug("line 3")

tl.LogContext.levels[""] = "warning"
tl.LogContext.dest_levels[None] = "warning"
tl.LogContext.dest_levels[""] = "warning"
tl.log("line 4")

tl.run_task_loop(main)
Expand Down

0 comments on commit 8b2e28a

Please sign in to comment.