lighthouse-pulse/lighthouse/utils/logging.rs

23 lines
597 B
Rust
Raw Normal View History

2018-07-20 07:47:10 +00:00
extern crate slog;
extern crate slog_term;
extern crate slog_async;
use slog::*;
pub use slog::Logger;
pub fn test_logger() -> slog::Logger {
let plain = slog_term::PlainSyncDecorator::new(slog_term::TestStdoutWriter);
2018-09-21 22:17:31 +00:00
Logger::root(
2018-07-20 07:47:10 +00:00
slog_term::FullFormat::new(plain)
.build().fuse(), o!()
2018-09-21 22:17:31 +00:00
)
2018-07-20 07:47:10 +00:00
}
pub fn get_logger() -> slog::Logger {
let decorator = slog_term::TermDecorator::new().build();
let drain = slog_term::CompactFormat::new(decorator).build().fuse();
let drain = slog_async::Async::new(drain).build().fuse();
slog::Logger::root(drain, o!())
}