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