From 04b2f9fb701da05a45f4c375c1beabce4d5a92d7 Mon Sep 17 00:00:00 2001 From: Michael Scovetta Date: Thu, 8 Aug 2024 16:16:08 -0400 Subject: [PATCH] Change logging stream to stderr. Logging was set to go to stdout, same as output, which breaks json output. This change has the logging go to stderr instead. --- guarddog/cli.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/guarddog/cli.py b/guarddog/cli.py index 106a22cd..1a80510e 100644 --- a/guarddog/cli.py +++ b/guarddog/cli.py @@ -114,9 +114,9 @@ def cli(log_level): """ logger = logging.getLogger("guarddog") logger.setLevel(logging.getLevelName(log_level)) - stdoutHandler = logging.StreamHandler(stream=sys.stdout) - stdoutHandler.setFormatter(logging.Formatter("%(levelname)s: %(message)s")) - logger.addHandler(stdoutHandler) + stderrHandler = logging.StreamHandler(stream=sys.stderr) + stderrHandler.setFormatter(logging.Formatter("%(levelname)s: %(message)s")) + logger.addHandler(stderrHandler) def _get_all_rules(ecosystem: ECOSYSTEM) -> set[str]: