From 03db16460af6e1a66f45ab936279483b7ea3b536 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 6 Apr 2020 15:57:13 +1000 Subject: [PATCH] log to the terminal as well --- rslib/src/log.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/rslib/src/log.rs b/rslib/src/log.rs index 82c7a9a98..2bf9562ba 100644 --- a/rslib/src/log.rs +++ b/rslib/src/log.rs @@ -28,7 +28,15 @@ fn file(path: &str) -> io::Result { 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()