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 authored and radoering committed Apr 26, 2022
1 parent 85ff887 commit 50ef227
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions src/poetry/console/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,23 +232,30 @@ 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
if (
logger.name.startswith("poetry.core.masonry.builders")
and _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 50ef227

Please sign in to comment.