forked from github-starred/komodo
implement tracing
This commit is contained in:
@@ -14,4 +14,4 @@ mungos.workspace = true
|
||||
mongo_indexed.workspace = true
|
||||
#
|
||||
anyhow.workspace = true
|
||||
log.workspace = true
|
||||
tracing.workspace = true
|
||||
@@ -1,5 +1,5 @@
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
extern crate tracing;
|
||||
|
||||
use mongo_indexed::{create_index, create_unique_index, Indexed};
|
||||
use monitor_client::entities::{
|
||||
|
||||
@@ -8,6 +8,6 @@ license.workspace = true
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
log.workspace = true
|
||||
simple_logger.workspace = true
|
||||
tracing.workspace = true
|
||||
tracing-subscriber.workspace = true
|
||||
anyhow.workspace = true
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
use anyhow::Context;
|
||||
use log::LevelFilter;
|
||||
use simple_logger::SimpleLogger;
|
||||
use tracing::level_filters::LevelFilter;
|
||||
|
||||
pub fn init(log_level: LevelFilter) -> anyhow::Result<()> {
|
||||
SimpleLogger::new()
|
||||
.with_level(log_level)
|
||||
.env()
|
||||
.with_colors(true)
|
||||
.with_utc_timestamps()
|
||||
pub fn init(log_level: tracing::Level) {
|
||||
tracing_subscriber::fmt()
|
||||
.with_level(true)
|
||||
.with_line_number(true)
|
||||
.with_max_level(LevelFilter::from(log_level))
|
||||
.init()
|
||||
.context("failed to configure logger")
|
||||
}
|
||||
|
||||
@@ -13,6 +13,6 @@ monitor_periphery.workspace = true
|
||||
reqwest.workspace = true
|
||||
anyhow.workspace = true
|
||||
serde_json.workspace = true
|
||||
log.workspace = true
|
||||
tracing.workspace = true
|
||||
resolver_api.workspace = true
|
||||
serror.workspace = true
|
||||
@@ -1,5 +1,5 @@
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
extern crate tracing;
|
||||
|
||||
use std::time::Duration;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user