diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2021-04-07 18:04:01 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2021-04-07 18:04:01 +0200 |
commit | f94c95cd71a1a6d3d2925242a94c128fe118ec5a (patch) | |
tree | dc5a4ee6d3c19bf15138fb24a57dc4a82fcbfb4c | |
parent | 8f44f7c9d7877e9dba11e09fdd1b80ffa0013d42 (diff) |
bin: Add logging
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r-- | Cargo.toml | 6 | ||||
-rw-r--r-- | src/main.rs | 8 |
2 files changed, 10 insertions, 4 deletions
@@ -16,11 +16,13 @@ license = "GPL-2.0-only" maintenance = { status = "actively-developed" } [dependencies] -librepology = { version = "0.1.0", path = "./librepology" } anyhow = "1" +env_logger = "0.8" +librepology = { version = "0.1.0", path = "./librepology" } +log = "0.4" +result-inspect = "0.2" serde = "1" serde_json = "1" -log = "0.4" tokio = { version = "1", features = ["full"] } [dependencies.clap] diff --git a/src/main.rs b/src/main.rs index 4c0cdcf..fd1f5d5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,7 @@ use anyhow::anyhow; use anyhow::Result; use clap::ArgMatches; +use result_inspect::*; use librepology::v1::api::*; use librepology::v1::types::response::Problem; @@ -10,6 +11,7 @@ mod cli; #[tokio::main] async fn main() -> Result<()> { + let _ = env_logger::try_init()?; let app = cli::app(); match app.get_matches().subcommand() { @@ -25,8 +27,10 @@ async fn problems<'a>(matches: &ArgMatches<'a>) -> Result<()> { .for_repo(repo) .to_request() .perform() - .await? - .deserialize::<Vec<Problem>>()? + .await + .inspect(|response| log::debug!("Response: {:?}", response))? + .deserialize::<Vec<Problem>>() + .inspect(|des| log::debug!("Deserialized: {:?}", des))? .into_iter() .for_each(|problem| { println!("Problem: {:?}", problem); |