diff --git a/src/lib.rs b/src/lib.rs index 6b43a9ae1..5f36e9606 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -635,6 +635,21 @@ impl FromStr for LevelFilter { } } +impl From for Option { + fn from(level: LevelFilter) -> Option { + level.to_level() + } +} + +impl From> for LevelFilter { + fn from(level: Option) -> LevelFilter { + match level { + Some(level) => level.to_level_filter(), + None => LevelFilter::Off, + } + } +} + impl fmt::Display for LevelFilter { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fmt.pad(self.as_str())