Skip to content
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

Merged
merged 2 commits into from
Sep 18, 2019
Merged

*: clean up the usage of slog #288

merged 2 commits into from
Sep 18, 2019

Conversation

BusyJay
Copy link
Member

@BusyJay BusyJay commented Sep 12, 2019

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 and reduces unnecessary dependencies.

  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.

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.
@BusyJay BusyJay added the Enhancement An improvement to existing code. label Sep 12, 2019
Copy link
Contributor

@Hoverbear Hoverbear left a 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.

harness/src/lib.rs Show resolved Hide resolved
src/raft.rs Show resolved Hide resolved
Copy link
Contributor

@nrc nrc left a 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)]
Copy link
Contributor

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

Copy link
Member Author

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.

@BusyJay BusyJay merged commit a82ce9f into master Sep 18, 2019
@BusyJay BusyJay deleted the cleanup-slog branch September 18, 2019 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement An improvement to existing code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants