2020-02-14 12:20:17 +01:00
|
|
|
use slog::{Drain, Logger};
|
|
|
|
use slog_async;
|
2021-11-26 03:42:30 +01:00
|
|
|
use slog_async::AsyncGuard;
|
2020-02-14 12:20:17 +01:00
|
|
|
use slog_term::{TermDecorator, FullFormat};
|
|
|
|
|
2021-11-26 03:42:30 +01:00
|
|
|
pub fn init() -> (Logger, AsyncGuard) {
|
2020-02-14 12:20:17 +01:00
|
|
|
let decorator = TermDecorator::new().build();
|
|
|
|
let drain = FullFormat::new(decorator).build().fuse();
|
2021-11-26 03:42:30 +01:00
|
|
|
let (drain, guard) = slog_async::Async::new(drain).build_with_guard();
|
|
|
|
let drain = drain.fuse();
|
2020-02-14 12:20:17 +01:00
|
|
|
|
2021-11-26 03:42:30 +01:00
|
|
|
return (slog::Logger::root(drain, o!()), guard);
|
2020-02-14 12:20:17 +01:00
|
|
|
}
|