Added tracing instead of log
This commit is contained in:
@@ -13,6 +13,7 @@ walkdir = "2.3.2"
|
||||
git2 = { version = "0.15.0", features = ["ssh"] }
|
||||
clap = "3.2.16"
|
||||
envconfig = "0.10.0"
|
||||
log = { version = "0.4.17", features = ["kv_unstable", "serde", "std"] }
|
||||
simplelog = "0.12.0"
|
||||
dirs = "4.0.0"
|
||||
tracing = "0.1.36"
|
||||
tracing-subscriber = { version = "0.3.15", features = ["json"] }
|
||||
log = { version = "0.4.17", features = ["std", "kv_unstable"] }
|
||||
|
@@ -1,7 +1,4 @@
|
||||
use std::fs::File;
|
||||
|
||||
use config::CuddleConfig;
|
||||
use simplelog::{ColorChoice, CombinedLogger, Config, TermLogger, TerminalMode, WriteLogger};
|
||||
|
||||
mod actions;
|
||||
mod cli;
|
||||
@@ -21,22 +18,7 @@ fn main() -> anyhow::Result<()> {
|
||||
}
|
||||
|
||||
fn init_logging() -> anyhow::Result<()> {
|
||||
let mut log_file = dirs::state_dir().ok_or(anyhow::anyhow!("could not find state_dir"))?;
|
||||
log_file.push("cuddle_cli.log");
|
||||
|
||||
CombinedLogger::init(vec![
|
||||
TermLogger::new(
|
||||
log::LevelFilter::Info,
|
||||
Config::default(),
|
||||
TerminalMode::Mixed,
|
||||
ColorChoice::Auto,
|
||||
),
|
||||
WriteLogger::new(
|
||||
log::LevelFilter::Debug,
|
||||
Config::default(),
|
||||
File::create(log_file).unwrap(),
|
||||
),
|
||||
])?;
|
||||
tracing_subscriber::fmt().pretty().json().init();
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
Reference in New Issue
Block a user