Add debug logs.

Test: Built, ran with RUST_LOG=debug, looked at logs
Change-Id: I87d9bce4eaff3fb1270eb3e421580220763fcb2c
diff --git a/tools/cargo_embargo/Android.bp b/tools/cargo_embargo/Android.bp
index 8e8d5d7..e6f20e7 100644
--- a/tools/cargo_embargo/Android.bp
+++ b/tools/cargo_embargo/Android.bp
@@ -24,7 +24,9 @@
     rustlibs: [
         "libanyhow",
         "libclap",
+        "libenv_logger",
         "libglob",
+        "liblog_rust",
         "libonce_cell",
         "libregex",
         "libserde",
diff --git a/tools/cargo_embargo/src/cargo/cargo_out.rs b/tools/cargo_embargo/src/cargo/cargo_out.rs
index b55d84a..04fc14c 100644
--- a/tools/cargo_embargo/src/cargo/cargo_out.rs
+++ b/tools/cargo_embargo/src/cargo/cargo_out.rs
@@ -18,6 +18,7 @@
 use anyhow::bail;
 use anyhow::Context;
 use anyhow::Result;
+use log::debug;
 use once_cell::sync::Lazy;
 use regex::Regex;
 use std::collections::BTreeMap;
@@ -52,6 +53,7 @@
     base_directory: impl AsRef<Path>,
 ) -> Result<Vec<Crate>> {
     let cargo_out = CargoOut::parse(cargo_out).context("failed to parse cargo.out")?;
+    debug!("Parsed cargo output: {:?}", cargo_out);
 
     assert!(cargo_out.cc_invocations.is_empty(), "cc not supported yet");
     assert!(cargo_out.ar_invocations.is_empty(), "ar not supported yet");
diff --git a/tools/cargo_embargo/src/main.rs b/tools/cargo_embargo/src/main.rs
index 8ad72db..bd0afad 100644
--- a/tools/cargo_embargo/src/main.rs
+++ b/tools/cargo_embargo/src/main.rs
@@ -42,6 +42,7 @@
 };
 use clap::Parser;
 use clap::Subcommand;
+use log::debug;
 use once_cell::sync::Lazy;
 use std::collections::BTreeMap;
 use std::collections::VecDeque;
@@ -117,6 +118,7 @@
 }
 
 fn main() -> Result<()> {
+    env_logger::init();
     let args = Args::parse();
 
     let json_str = std::fs::read_to_string(&args.cfg)
@@ -171,6 +173,7 @@
         let mut paths = std::env::split_paths(&path).collect::<VecDeque<_>>();
         paths.push_front(cargo_bin.to_owned());
         let new_path = std::env::join_paths(paths)?;
+        debug!("Set PATH to {:?}", new_path);
         std::env::set_var("PATH", new_path);
     }
 
@@ -251,7 +254,7 @@
     use std::os::unix::io::OwnedFd;
     use std::process::Stdio;
     let fd: OwnedFd = cargo_out.try_clone()?.into();
-    // eprintln!("Running: {:?}\n", cmd);
+    debug!("Running: {:?}\n", cmd);
     let output = cmd.stdout(Stdio::from(fd.try_clone()?)).stderr(Stdio::from(fd)).output()?;
     if !output.status.success() {
         bail!("cargo command failed with exit status: {:?}", output.status);