Skip to content

Commit

Permalink
add: log level to "metrics" cli args
Browse files Browse the repository at this point in the history
  • Loading branch information
0xB10C committed Sep 4, 2024
1 parent 1b07f60 commit 9548837
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tools/metrics/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use shared::nng::options::protocol::pubsub::Subscribe;
use shared::nng::options::Options;
use shared::nng::{Protocol, Socket};
use shared::prost::Message;
use shared::simple_logger::SimpleLogger;
use shared::simple_logger;
use shared::util;
use shared::validation::validation_event;
use std::collections::HashMap;
Expand All @@ -35,14 +35,16 @@ struct Args {
/// The metrics server address the tool should listen on.
#[arg(short, long, default_value = "127.0.0.1:8282")]
metrics_address: String,
/// The log level the tool should run with. Valid log levels
/// are "trace", "debug", "info", "warn", "error". See https://docs.rs/log/latest/log/enum.Level.html
#[arg(short, long, default_value_t = log::Level::Debug)]
log_level: log::Level,
}

fn main() {
let args = Args::parse();

SimpleLogger::new()
.init()
.expect("Could not setup logging.");
simple_logger::init_with_level(args.log_level).unwrap();

log::info!(target: LOG_TARGET, "Starting metrics-server...",);

Expand Down

0 comments on commit 9548837

Please sign in to comment.