Use pretty_env_logger
This commit is contained in:
13
Cargo.lock
generated
13
Cargo.lock
generated
@@ -1032,6 +1032,16 @@ name = "ppv-lite86"
|
|||||||
version = "0.2.5"
|
version = "0.2.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pretty_env_logger"
|
||||||
|
version = "0.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "0.4.30"
|
version = "0.4.30"
|
||||||
@@ -1883,7 +1893,6 @@ dependencies = [
|
|||||||
"chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
"chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"console 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
"console 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"directories 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"directories 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
|
"futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@@ -1891,6 +1900,7 @@ dependencies = [
|
|||||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"nix 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"nix 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"pretty_env_logger 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"self_update 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"self_update 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@@ -2241,6 +2251,7 @@ dependencies = [
|
|||||||
"checksum pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c1d2cfa5a714db3b5f24f0915e74fcdf91d09d496ba61329705dda7774d2af"
|
"checksum pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c1d2cfa5a714db3b5f24f0915e74fcdf91d09d496ba61329705dda7774d2af"
|
||||||
"checksum podio 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "780fb4b6698bbf9cf2444ea5d22411cef2953f0824b98f33cf454ec5615645bd"
|
"checksum podio 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "780fb4b6698bbf9cf2444ea5d22411cef2953f0824b98f33cf454ec5615645bd"
|
||||||
"checksum ppv-lite86 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e3cbf9f658cdb5000fcf6f362b8ea2ba154b9f146a61c7a20d647034c6b6561b"
|
"checksum ppv-lite86 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e3cbf9f658cdb5000fcf6f362b8ea2ba154b9f146a61c7a20d647034c6b6561b"
|
||||||
|
"checksum pretty_env_logger 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "df8b3f4e0475def7d9c2e5de8e5a1306949849761e107b360d03e98eafaffd61"
|
||||||
"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
|
"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
|
||||||
"checksum publicsuffix 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5afecba86dcf1e4fd610246f89899d1924fe12e1e89f555eb7c7f710f3c5ad1d"
|
"checksum publicsuffix 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5afecba86dcf1e4fd610246f89899d1924fe12e1e89f555eb7c7f710f3c5ad1d"
|
||||||
"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0"
|
"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0"
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ which_crate = { version = "2.0.1", package = "which" }
|
|||||||
shellexpand = "1.0.0"
|
shellexpand = "1.0.0"
|
||||||
structopt = "0.2.16"
|
structopt = "0.2.16"
|
||||||
log = "0.4.6"
|
log = "0.4.6"
|
||||||
env_logger = "0.6.1"
|
|
||||||
walkdir = "2.2.7"
|
walkdir = "2.2.7"
|
||||||
console = "0.7.5"
|
console = "0.7.5"
|
||||||
self_update_crate = { version = "0.5.1", optional = true, package = "self_update" }
|
self_update_crate = { version = "0.5.1", optional = true, package = "self_update" }
|
||||||
@@ -31,6 +30,7 @@ tokio = "0.1.21"
|
|||||||
tokio-process = "0.2.3"
|
tokio-process = "0.2.3"
|
||||||
futures = "0.1.27"
|
futures = "0.1.27"
|
||||||
openssl-probe = { version = "0.1.2", optional = true }
|
openssl-probe = { version = "0.1.2", optional = true }
|
||||||
|
pretty_env_logger = "0.3.0"
|
||||||
|
|
||||||
[target.'cfg(unix)'.dependencies]
|
[target.'cfg(unix)'.dependencies]
|
||||||
nix = "0.14.0"
|
nix = "0.14.0"
|
||||||
|
|||||||
12
src/main.rs
12
src/main.rs
@@ -15,11 +15,11 @@ use self::error::{Error, ErrorKind};
|
|||||||
use self::report::Report;
|
use self::report::Report;
|
||||||
use self::steps::*;
|
use self::steps::*;
|
||||||
use self::terminal::*;
|
use self::terminal::*;
|
||||||
use env_logger::Env;
|
|
||||||
use failure::{Fail, ResultExt};
|
use failure::{Fail, ResultExt};
|
||||||
use log::debug;
|
use log::{debug, LevelFilter};
|
||||||
#[cfg(feature = "self-update")]
|
#[cfg(feature = "self-update")]
|
||||||
use openssl_probe;
|
use openssl_probe;
|
||||||
|
use pretty_env_logger::formatted_timed_builder;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
@@ -75,11 +75,13 @@ fn run() -> Result<(), Error> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut env = Env::default();
|
let mut builder = formatted_timed_builder();
|
||||||
|
|
||||||
if config.verbose() {
|
if config.verbose() {
|
||||||
env = env.filter_or("LOG_LEVEL", "topgrade=debug");
|
builder.filter(Some("topgrade"), LevelFilter::Debug);
|
||||||
}
|
}
|
||||||
env_logger::init_from_env(env);
|
|
||||||
|
builder.init();
|
||||||
|
|
||||||
let git = git::Git::new();
|
let git = git::Git::new();
|
||||||
let mut git_repos = git::Repositories::new(&git);
|
let mut git_repos = git::Repositories::new(&git);
|
||||||
|
|||||||
Reference in New Issue
Block a user