default to WARN logging if RUST_LOG is unspecified

This commit is contained in:
Lynne Megido 2021-02-28 21:01:22 +10:00
parent b89e71a6ab
commit 601481130f
Signed by: lynnesbian
GPG key ID: F0A184B5213D9F90
2 changed files with 6 additions and 2 deletions

View file

@ -5,7 +5,7 @@ version = "0.2.6"
authors = ["Lynnesbian <lynne@bune.city>"] authors = ["Lynnesbian <lynne@bune.city>"]
edition = "2018" edition = "2018"
license = "GPL-3.0-or-later" license = "GPL-3.0-or-later"
rust-version = "1.43.0" # cached requires 1.42.0 rust-version = "1.43.0" # cached breaks on 1.42.0, i think it needs https://github.com/rust-lang/rust/pull/67642/
repository = "https://git.bune.city/lynnesbian/fif" repository = "https://git.bune.city/lynnesbian/fif"
readme = "README.md" readme = "README.md"
keywords = ["mime", "mimetype", "utilities", "tools"] keywords = ["mime", "mimetype", "utilities", "tools"]

View file

@ -32,6 +32,7 @@ use crate::mimedb::MimeDb;
use crate::parameters::OutputFormat; use crate::parameters::OutputFormat;
use crate::scanerror::ScanError; use crate::scanerror::ScanError;
use std::process::exit; use std::process::exit;
use env_logger::Env;
mod extensionset; mod extensionset;
mod findings; mod findings;
@ -215,7 +216,10 @@ fn init_db() {
fn main() { fn main() {
let args = parameters::Parameters::parse(); let args = parameters::Parameters::parse();
let mut builder = env_logger::Builder::from_default_env(); let mut builder = env_logger::Builder::from_env(
Env::new().filter_or("RUST_LOG", "WARN")
);
builder builder
// .format(|buf, r| writeln!(buf, "{} - {}", r.level(), r.args())) // .format(|buf, r| writeln!(buf, "{} - {}", r.level(), r.args()))
.format_module_path(false) // don't include module in logs, as it's not necessary .format_module_path(false) // don't include module in logs, as it's not necessary