From 8b2e28ac4f1adcaec2bba43bf0ff3b50ccb70f5b Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Tue, 26 Mar 2024 10:46:27 +1300 Subject: [PATCH] fixup! Add tests for destination log level filtering --- tests/task_loop/test_logging.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/tests/task_loop/test_logging.py b/tests/task_loop/test_logging.py index 3ba3046..ca53b99 100644 --- a/tests/task_loop/test_logging.py +++ b/tests/task_loop/test_logging.py @@ -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") @@ -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)