diff --git a/ch_backup/logging.py b/ch_backup/logging.py index 6049cd83..58c8f701 100644 --- a/ch_backup/logging.py +++ b/ch_backup/logging.py @@ -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):