rust-lang / log

Logging implementation for Rust
https://docs.rs/log
Apache License 2.0
2.18k stars 252 forks source link

Derive `Deserialize` for `Level` #597

Closed max-ishere closed 10 months ago

max-ishere commented 10 months ago

It would be nice to have this trait on the log crate (even behind a feature flag) to allow applications to use serde to parse the log levels.

The example use case would be a log level contained in a config file that is parsed with serde.

While looking up enum serialization I found this: Serialization of an enum variant with serde which makes it look like a simple derive macro would be enough to add to the code.

max-ishere commented 10 months ago

Oops, my bad, got confused by the compiler error and didnt see that it was behind a feature flag