We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
from loguru import logger from app import hello_loguru from app2 import hello_loguru2 logger.add("logs/loguru_app_{time:YYYY-MM-DD}.log", level="INFO", rotation='00:00', encoding='utf-8', # filter=lambda x: __name__ in x, filter="app", compression="zip" ) logger.add("logs/loguru_app2_{time:YYYY-MM-DD}.log", level="INFO", rotation='00:00', encoding='utf-8', filter="app2", compression="zip" ) if __name__ == "__main__": logger.info("in main") hello_loguru.go_logger() hello_loguru2.go_logger()
# _filters.py def filter_none(record): return record["name"] is not None def filter_by_name(record, parent, length): name = record["name"] if name is None: return False return (name + ".")[:length] == parent def filter_by_level(record, level_per_module): name = record["name"] while True: level = level_per_module.get(name, None) if level is False: return False if level is not None: return record["level"].no >= level if not name: return True index = name.rfind(".") name = name[:index] if index != -1 else ""
The text was updated successfully, but these errors were encountered:
No branches or pull requests
或许正确的使用方式
loguru的源码
The text was updated successfully, but these errors were encountered: