Description
Feature Request
As of now only set_global_default
is only reliable way to set logger available to all threads within application.
While set_default
/with_default
actually sets logger onto thread local hence making it unsuitable for needs of multi-threaded application.
Documentation on these functions fails to mention that.
Ideally we should have be able to created scoped and global logger.
The reason being is that sometimes you want to be able to gracefully drop your logger, especially if you have some caching mechanism to prevent network IO from being used too often.
In my case I have fluentd logger which only sends log records after reaching certain limit, hence I need logger to be scoped so that it would flush it on application termination.
Obviously I can do it with hacks myself, but I believe proper logger would benefit from having scoped guard for global one.
Considering complexity of tracing
over log
I do not see a reason to copy this flaw
Alternatives
Install default logger with each new thread