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:
Mac L
2023-04-03 05:35:11 +00:00
parent 1e029ce538
commit 8630ddfec4
80 changed files with 7663 additions and 236 deletions

24
watch/src/logger.rs Normal file
View 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}");
}