Open zhangchunsheng opened 1 month ago
Could you please explain your problem further?
Keep in mind that each of your file share the same logger
. They all write messages to the same set of handlers you configured.
Therefore, if you want to use different levels for different file, you can use a filter
like so:
levels = {
"": "DEBUG", # Default
"module_a": "INFO",
"module_b": "WARNING",
}
logger.remove() # Remove default handler.
logger.add(sys.stderr, filter=levels)
If you need to create truly independent loggers, take a look a this page of the documentation: Creating independent loggers with separate set of handlers.
@zhangchunsheng Can this be closed?
Can't change sys.stdout level in different file. #505, How to create new object logger.