From 60396e80822c0453aad1638e9f956fb159402402 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Mon, 28 Oct 2024 14:28:44 -0400 Subject: [PATCH 1/2] fix: don't add a handler if there's already one Signed-off-by: Henry Schreiner --- nox/logger.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nox/logger.py b/nox/logger.py index 333d8bdb..2b3d0f4c 100644 --- a/nox/logger.py +++ b/nox/logger.py @@ -120,6 +120,9 @@ def setup_logging( colorlog. Otherwise, it will be plaintext. """ root_logger = logging.getLogger() + if root_logger.hasHandlers(): + return + if verbose: root_logger.setLevel(OUTPUT) else: From 5c76a03cabc4732c645034a66c4a8a75e4089f44 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Thu, 31 Oct 2024 23:26:58 -0400 Subject: [PATCH 2/2] Update logger.py --- nox/logger.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nox/logger.py b/nox/logger.py index 2b3d0f4c..15259a38 100644 --- a/nox/logger.py +++ b/nox/logger.py @@ -120,8 +120,6 @@ def setup_logging( colorlog. Otherwise, it will be plaintext. """ root_logger = logging.getLogger() - if root_logger.hasHandlers(): - return if verbose: root_logger.setLevel(OUTPUT) @@ -129,6 +127,9 @@ def setup_logging( root_logger.setLevel(logging.DEBUG) handler = logging.StreamHandler() + if root_logger.hasHandlers(): + return + handler.setFormatter(_get_formatter(color, add_timestamp)) root_logger.addHandler(handler)