mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-09 03:17:55 +00:00
Add beacon.watch (#3362)
> This is currently a WIP and all features are subject to alteration or removal at any time. ## Overview The successor to #2873. Contains the backbone of `beacon.watch` including syncing code, the initial API, and several core database tables. See `watch/README.md` for more information, requirements and usage.
This commit is contained in:
24
watch/src/logger.rs
Normal file
24
watch/src/logger.rs
Normal file
@@ -0,0 +1,24 @@
|
||||
use env_logger::Builder;
|
||||
use log::{info, LevelFilter};
|
||||
use std::process;
|
||||
|
||||
pub fn init_logger(log_level: &str) {
|
||||
let log_level = match log_level.to_lowercase().as_str() {
|
||||
"trace" => LevelFilter::Trace,
|
||||
"debug" => LevelFilter::Debug,
|
||||
"info" => LevelFilter::Info,
|
||||
"warn" => LevelFilter::Warn,
|
||||
"error" => LevelFilter::Error,
|
||||
_ => {
|
||||
eprintln!("Unsupported log level");
|
||||
process::exit(1)
|
||||
}
|
||||
};
|
||||
|
||||
let mut builder = Builder::new();
|
||||
builder.filter(Some("watch"), log_level);
|
||||
|
||||
builder.init();
|
||||
|
||||
info!("Logger initialized with log-level: {log_level}");
|
||||
}
|
||||
Reference in New Issue
Block a user