如果我取消create_log,都log和LOG打印在控制台上.没有它,什么也没有打印出来.到底是怎么回事?
#[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"); …Run Code Online (Sandbox Code Playgroud) rust ×1