Last active
October 25, 2016 23:37
-
-
Save caipre/a63f739a87e7929db3a41280322ade2f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[macro_use] | |
extern crate slog; | |
extern crate slog_term; | |
use slog::DrainExt; | |
#[derive(Debug)] | |
enum Topic { | |
First, | |
Second, | |
Third, | |
} | |
macro_rules! debugify | |
{ ($v:path) => (format!("{:?}", $v)) } | |
fn main() { | |
let drain = slog_term::streamer().compact().build().fuse(); | |
let log = slog::Logger::root(drain, o!("version" => "0.5")); | |
warn!(log, "topic" => debugify!(Topic::First); "message"); | |
warn!(log, "message"; "topic" => debugify!(Topic::First)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment