If I uncomment create_log
, both log
and LOG
are printed on the console. Without it, nothing is printed. What is going on?
#[macro_use]
extern crate slog;
extern crate slog_term;
extern crate slog_async;
#[macro_use]
extern crate lazy_static;
use slog::Drain;
lazy_static! {
static ref LOG: slog::Logger = create_log();
}
fn create_log() -> slog::Logger {
let decorator = slog_term::TermDecorator::new().force_plain().build();
let drain = slog_term::CompactFormat::new(decorator).build().fuse();
let drain = slog_async::Async::new(drain).build().fuse();
slog::Logger::root(drain, o!())
}
fn main() {
info!(LOG, "LOG"); // NOT printed unless next line is uncommented
// let log = create_log(); // enables printing both log and LOG
// info!(log, "log");
}