mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-21 05:44:44 +00:00
Implement slog
This commit is contained in:
23
src/utils/logging.rs
Normal file
23
src/utils/logging.rs
Normal file
@@ -0,0 +1,23 @@
|
||||
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);
|
||||
let logger = Logger::root(
|
||||
slog_term::FullFormat::new(plain)
|
||||
.build().fuse(), o!()
|
||||
);
|
||||
logger
|
||||
}
|
||||
|
||||
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!())
|
||||
}
|
||||
@@ -9,3 +9,4 @@ pub mod types;
|
||||
pub mod bls;
|
||||
pub mod test_helpers;
|
||||
pub mod boolean_bitfield;
|
||||
pub mod logging;
|
||||
|
||||
Reference in New Issue
Block a user