Skip to content

Commit

Permalink
fix: make filter private and move Display impl to Verbosity
Browse files Browse the repository at this point in the history
  • Loading branch information
joshka committed Nov 15, 2024
1 parent b38e4c1 commit 7d80f10
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ impl<L: LogLevel> Verbosity<L> {
///
/// Used to calculate the log level and filter.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Filter {
enum Filter {
Off,
Error,
Warn,
Expand Down Expand Up @@ -213,9 +213,9 @@ impl Filter {
}
}

impl fmt::Display for Filter {
impl<L: LogLevel> fmt::Display for Verbosity<L> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
match self.filter() {
Filter::Off => write!(f, "off"),
Filter::Error => write!(f, "error"),
Filter::Warn => write!(f, "warn"),
Expand All @@ -226,12 +226,6 @@ impl fmt::Display for Filter {
}
}

impl<L: LogLevel> fmt::Display for Verbosity<L> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.filter())
}
}

/// Customize the default log-level and associated help
pub trait LogLevel {
#[cfg(feature = "log")]
Expand Down

0 comments on commit 7d80f10

Please sign in to comment.