Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix extra logs. #74

Merged
merged 2 commits into from
Sep 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions ch_backup/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,25 @@ def configure(config_loguru: dict) -> None:
"sink": value["sink"],
"format": config_loguru["formatters"][value["format"]],
"enqueue": True,
"filter": value["filter"] if "filter" in value else make_filter(name),
}
if "level" in value:
handler["level"] = value["level"]

if "filter" in value:
handler["filter"] = value["filter"]
# https://loguru.readthedocs.io/en/stable/api/logger.html#message
# One can also pass a dict mapping module names to minimum required level. In such case, each log record will search for it’s closest parent in the dict
# and use the associated level as the filter.
# In order to set a default level, the "" module name should be used as it is the parent of all modules (it does not suppress global level threshold, though).
handler["filter"][""] = False
else:
handler["filter"] = make_filter(name)
loguru_handlers.append(handler)

logger.configure(handlers=loguru_handlers, activation=[("", True)])

# Configure logging.
logging.basicConfig(handlers=[InterceptHandler()], level=0)
logging.debug("Checkroot")


def critical(msg, *args, **kwargs):
Expand Down