-
Notifications
You must be signed in to change notification settings - Fork 259
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
Logger Composability Guidelines #267
Comments
I think it would make sense to update the "implementing a logger" section of the docs to say that you should provide a constructor for your |
One interesting question is who should control the max log level. Should the |
@sfackler i do wonder if it wouldn't make sense to have the |
That would handle part of it, but there's still the case where the logger is reconfiguring itself at runtime. |
In |
It's been a long time here. |
This is not necessarily a feature request but maybe a request for guidelines. Currently a lot of crates provide something like
try_init
orinit
where a logger is set as the global handler. As there can only be one it means that once that happens nobody can change it (unlike for instance the panic hook which can be overridden).As a result crates like sentry that want to get logger data in addition to dispatching to another logger run into the issue where the user needs to completely change their code to get it hooked. For instance the
pretty_env_logger
and many others do not even provide a convenient way to say "get me a logger with default config" but don't register it.Would it make sense to encourage loggers to provide a standardized API that returns a logger but does not register it? A similar issue also happens with the global level where users themselves need to figure out what the highest level is that multiple loggers might need.
The text was updated successfully, but these errors were encountered: