log to the terminal as well

This commit is contained in:
Damien Elmes 2020-04-06 15:57:13 +10:00
parent dc62d5072c
commit 03db16460a

View file

@ -28,7 +28,15 @@ fn file(path: &str) -> io::Result<Logger> {
let decorator = slog_term::PlainSyncDecorator::new(file);
let drain = slog_term::FullFormat::new(decorator).build().fuse();
let drain = slog_envlogger::new(drain);
let drain = slog_async::Async::new(drain)
// log to the terminal as well
let decorator = slog_term::TermDecorator::new().build();
let term_drain = slog_term::FullFormat::new(decorator).build().fuse();
let term_drain = slog_envlogger::new(term_drain);
let joined_drain = slog::Duplicate::new(drain, term_drain).fuse();
let drain = slog_async::Async::new(joined_drain)
.chan_size(1_024)
.overflow_strategy(OverflowStrategy::Block)
.build()