From 976995b0f8d869e423f852cb3c481f273d69500c Mon Sep 17 00:00:00 2001 From: Arun Babu Neelicattu Date: Tue, 26 Apr 2022 17:32:57 +0200 Subject: [PATCH] application: set global log handlers --- src/poetry/console/application.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/poetry/console/application.py b/src/poetry/console/application.py index 44a0efd7b0d..178276974f1 100644 --- a/src/poetry/console/application.py +++ b/src/poetry/console/application.py @@ -232,23 +232,27 @@ def register_command_loggers( handler = IOHandler(io) handler.setFormatter(IOFormatter()) + level = logging.WARNING + + if io.is_debug(): + level = logging.DEBUG + elif io.is_very_verbose() or io.is_verbose(): + level = logging.INFO + + logging.basicConfig(level=level, handlers=[handler]) + for name in loggers: logger = logging.getLogger(name) logger.handlers = [handler] - level = logging.WARNING + _level = level # The builders loggers are special and we can actually # start at the INFO level. if logger.name.startswith("poetry.core.masonry.builders"): - level = logging.INFO - - if io.is_debug(): - level = logging.DEBUG - elif io.is_very_verbose() or io.is_verbose(): - level = logging.INFO + _level = logging.INFO - logger.setLevel(level) + logger.setLevel(_level) def configure_env( self, event: ConsoleCommandEvent, event_name: str, _: Any