diff options
author | notgne2 | 2020-12-27 10:48:18 -0700 |
---|---|---|
committer | notgne2 | 2020-12-27 10:52:37 -0700 |
commit | 4461d1ea3f494778f07041164f6b8a252bd26ea2 (patch) | |
tree | 85fc2196e5c6869947c5f2d92713ac2b3bde8e2b /src/activate.rs | |
parent | 91e934fd9e1e06044f75a3e3ad998813c2a90fb5 (diff) |
Replace logger, add more logging options including files
Diffstat (limited to 'src/activate.rs')
-rw-r--r-- | src/activate.rs | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/activate.rs b/src/activate.rs index 84d4b12..b982d72 100644 --- a/src/activate.rs +++ b/src/activate.rs @@ -18,7 +18,6 @@ use notify::{RecommendedWatcher, RecursiveMode, Watcher}; use thiserror::Error; -extern crate pretty_env_logger; #[macro_use] extern crate log; @@ -35,6 +34,13 @@ struct Opts { profile_path: String, closure: String, + /// Print debug logs to output + #[clap(short, long)] + debug_logs: bool, + /// File to print logs to (including the background activation process) + #[clap(long)] + log_dir: Option<String>, + /// Temp path for any temporary files that may be needed during activation #[clap(long)] temp_path: String, @@ -347,14 +353,10 @@ pub async fn activate( #[tokio::main] async fn main() -> Result<(), Box<dyn std::error::Error>> { - if std::env::var("DEPLOY_LOG").is_err() { - std::env::set_var("DEPLOY_LOG", "info"); - } - - pretty_env_logger::init_custom_env("DEPLOY_LOG"); - let opts: Opts = Opts::parse(); + utils::init_logger(opts.debug_logs, opts.log_dir.as_deref(), true)?; + match activate( opts.profile_path, opts.closure, |