-
Notifications
You must be signed in to change notification settings - Fork 400
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
*: clean up the usage of slog #288
Conversation
This commit brings 2 big changes to the API: 1. No more default logger. Users are required to give a logger to use the most of structs in this library. This makes the interface simple. 2. No more tag scope value. Some APIs insert tag into KVs, some don't. It's confusing and easily lead to duplicate KV definitions. Users are required to insert tag into KVs before passing the logger to the library, and there is no more explicit configuration of tag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM, a minor question but if others are OK with it feel free to merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, nice reduction of boilerplate!
@@ -47,19 +47,26 @@ use slog::{Drain, Logger}; | |||
/// Currently, this is a terminal log. It ensures it is only initialized once to prevent clobbering. | |||
// This is `pub` so that testing and benching functions can use it. | |||
// `#[cfg(test)]` doesn't work for benching. | |||
#[doc(hidden)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove doc(hidden)
? Seems like we don't want to make this public API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because harness is not a public library, will never be published to crates.io, doc hidden is unnecessary.
This commit brings 2 big changes to the API:
No more default logger.
Users are required to give a logger to use the most of structs in this library. This makes the interface simple and reduces unnecessary dependencies.
No more tag scope value.
Some APIs insert tag into KVs, some don't. It's confusing and easily lead to duplicate KV definitions. Users are required to insert tag into KVs before passing the logger to the library, and there is no more explicit configuration of tag.