Skip to content

Commit

Permalink
Made max pre-set verbosity level per PR comment
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesbraza committed Sep 27, 2024
1 parent 01af51b commit 57b57f3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion paperqa/agents/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,12 @@ def configure_cli_logging(verbosity: int = 0) -> None:
setup_default_logs()
set_up_rich_handler()

max_preset_verbosity: int = max(list(LOG_VERBOSITY_MAP.keys()))
for logger_name, logger_ in logging.Logger.manager.loggerDict.items():
if isinstance(logger_, logging.Logger) and (
log_level := LOG_VERBOSITY_MAP.get(min(verbosity, 2), {}).get(logger_name)
log_level := LOG_VERBOSITY_MAP.get(
min(verbosity, max_preset_verbosity), {}
).get(logger_name)
):
logger_.setLevel(log_level)

Expand Down

0 comments on commit 57b57f3

Please sign in to comment.