From f73de24fd7d2ce947a22fadf6fe9c97bedff17e0 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Tue, 31 Mar 2020 00:00:05 -0700 Subject: [PATCH] Add `log` variable to justfile (#621) Allows logging to be controlled with, for example: just log=trace run --- Cargo.toml | 28 ++++++++++++++-------------- justfile | 7 +++++++ src/common.rs | 2 +- src/run.rs | 1 + 4 files changed, 23 insertions(+), 15 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 6f2681e..483f1ba 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,20 +15,20 @@ help4help2man = [] summary = [] [dependencies] -ansi_term = "0.12.0" -atty = "0.2.0" -clap = "2.33.0" -derivative = "2.0.0" -dotenv = "0.15.0" -edit-distance = "2.0.0" -env_logger = "0.7.0" -lazy_static = "1.0.0" -libc = "0.2.0" -log = "0.4.4" -snafu = "0.6.0" -target = "1.0.0" -tempfile = "3.0.0" -unicode-width = "0.1.0" +ansi_term = "0.12.0" +atty = "0.2.0" +clap = "2.33.0" +derivative = "2.0.0" +dotenv = "0.15.0" +edit-distance = "2.0.0" +env_logger = "0.7.0" +lazy_static = "1.0.0" +libc = "0.2.0" +log = "0.4.4" +snafu = "0.6.0" +target = "1.0.0" +tempfile = "3.0.0" +unicode-width = "0.1.0" [dependencies.ctrlc] version = "3.1.1" diff --git a/justfile b/justfile index 1cc1acc..82846b8 100755 --- a/justfile +++ b/justfile @@ -10,12 +10,19 @@ bt := '0' export RUST_BACKTRACE := bt +log := "warn" + +export JUST_LOG := log + test: cargo test fuzz: cargo +nightly fuzz run fuzz-compiler +run: + cargo run + @spam: { \ figlet test; \ diff --git a/src/common.rs b/src/common.rs index 80201dd..7dee2b4 100644 --- a/src/common.rs +++ b/src/common.rs @@ -29,7 +29,7 @@ pub(crate) use crate::{node::Node, tree::Tree}; pub(crate) use derivative::Derivative; pub(crate) use edit_distance::edit_distance; pub(crate) use libc::EXIT_FAILURE; -pub(crate) use log::warn; +pub(crate) use log::{info, warn}; pub(crate) use snafu::{ResultExt, Snafu}; pub(crate) use unicode_width::UnicodeWidthChar; diff --git a/src/run.rs b/src/run.rs index ea36f1e..84e787b 100644 --- a/src/run.rs +++ b/src/run.rs @@ -13,6 +13,7 @@ pub fn run() -> Result<(), i32> { let app = Config::app(); + info!("Parsing command line arguments…"); let matches = app.get_matches(); let config = Config::from_matches(&matches).eprint(Color::auto())?;