Skip to content

Commit

Permalink
application: set global log handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
abn committed Apr 26, 2022
1 parent 0e5f953 commit 976995b
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/poetry/console/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 976995b

Please sign in to comment.