Add serde impls to LogLevel and LogLevelFilter

This commit is contained in:
Chris Fung 2017-05-21 00:32:49 -07:00
parent d9b22b4db7
commit 8b1523aa2f
No known key found for this signature in database
GPG Key ID: 13AC382B7E91D411
2 changed files with 5 additions and 0 deletions

View File

@ -41,3 +41,6 @@ default = ["use_std"]
[badges]
travis-ci = { repository = "rust-lang-nursery/log" }
appveyor = { repository = "alexcrichton/log" }
[dependencies]
serde = { version = ">= 1.0.7", optional = true }

View File

@ -283,6 +283,7 @@ static LEVEL_PARSE_ERROR: &'static str = "attempted to convert a string that doe
/// [`LevelFilter`](enum.LevelFilter.html).
#[repr(usize)]
#[derive(Copy, Eq, Debug, Hash)]
#[cfg_attr(serde, derive(Serialize, Deserialize))]
pub enum Level {
/// The "error" level.
///
@ -427,6 +428,7 @@ impl Level {
/// [`max_level()`](fn.max_level.html).
#[repr(usize)]
#[derive(Copy, Eq, Debug, Hash)]
#[cfg_attr(serde, derive(Serialize, Deserialize))]
pub enum LevelFilter {
/// A level lower than all log levels.
Off,