feat: enable trace logging support
This commit is contained in:
parent
6bac32bb7b
commit
ce33f4ab20
2 changed files with 13 additions and 2 deletions
|
@ -23,8 +23,8 @@ serde = { version = "1.0", features = ["derive"] }
|
|||
serde_json = "1.0"
|
||||
tokio = { version = "1.41", features = ["full"] }
|
||||
toml = "0.8"
|
||||
#tracing= "0.1"
|
||||
#tracing-subscriber = "0.3"
|
||||
tracing= "0.1"
|
||||
tracing-subscriber = "0.3"
|
||||
|
||||
[dev-dependencies]
|
||||
assert2 = "0.3"
|
||||
|
|
11
src/lib.rs
11
src/lib.rs
|
@ -27,6 +27,8 @@ use nextcloud::DeckClient;
|
|||
#[derive(Parser, Debug)]
|
||||
#[clap(version = clap::crate_version!(), author = clap::crate_authors!(), about = clap::crate_description!())]
|
||||
struct Commands {
|
||||
#[clap(long, action = clap::ArgAction::SetTrue)]
|
||||
log: bool,
|
||||
#[clap(subcommand)]
|
||||
command: Command,
|
||||
}
|
||||
|
@ -130,6 +132,15 @@ pub async fn run(ctx: Ctx) -> color_eyre::Result<()> {
|
|||
color_eyre::install()?;
|
||||
|
||||
let commands = Commands::parse();
|
||||
if commands.log {
|
||||
tracing::subscriber::set_global_default(
|
||||
tracing_subscriber::FmtSubscriber::builder()
|
||||
.with_max_level(tracing::Level::TRACE)
|
||||
.finish(),
|
||||
)?;
|
||||
tracing::info!("ready");
|
||||
}
|
||||
|
||||
let cfg = AppConfig::load(&ctx);
|
||||
match cfg {
|
||||
Err(err) => {
|
||||
|
|
Loading…
Reference in a new issue