diff --git a/Cargo.toml b/Cargo.toml index 2eb0a7d5894..d2d48ff7671 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,6 +25,7 @@ crypto-hash = "0.3.1" curl = { version = "0.4.19", features = ['http2'] } curl-sys = "0.4.15" env_logger = "0.6.0" +pretty_env_logger = { version = "0.2", optional = true } failure = "0.1.2" filetime = "0.2" flate2 = { version = "1.0.3", features = ['zlib'] } @@ -105,3 +106,4 @@ doc = false [features] vendored-openssl = ['openssl/vendored'] +pretty-env-logger = ['pretty_env_logger'] diff --git a/src/bin/cargo/main.rs b/src/bin/cargo/main.rs index 4dd90777f72..8839fdd41b7 100644 --- a/src/bin/cargo/main.rs +++ b/src/bin/cargo/main.rs @@ -3,6 +3,9 @@ extern crate cargo; extern crate clap; +#[cfg(feature = "pretty-env-logger")] +extern crate pretty_env_logger; +#[cfg(not(feature = "pretty-env-logger"))] extern crate env_logger; #[macro_use] extern crate failure; @@ -28,6 +31,9 @@ mod commands; use command_prelude::*; fn main() { + #[cfg(feature = "pretty-env-logger")] + pretty_env_logger::init(); + #[cfg(not(feature = "pretty-env-logger"))] env_logger::init(); cargo::core::maybe_allow_nightly_features();