diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/src/main.rs b/src/main.rs index f82e522..bbf4b70 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,12 +10,14 @@ use num_traits::cast::FromPrimitive; use regex::Regex; use structopt::StructOpt; use walkdir::{DirEntry, WalkDir}; +use log::debug; use evtclib::{AgentKind, AgentName, EventKind, Log}; +mod filters; mod guilds; +mod logger; mod output; -mod filters; mod csl; use csl::CommaSeparatedList; @@ -30,25 +32,6 @@ macro_rules! unwrap { }; } -macro_rules! debug { - ($($arg:tt)*) => { - if debug_enabled() { - use std::io::Write; - let stderr = ::std::io::stderr(); - let mut lock = stderr.lock(); - write!(lock, "[d] ").expect("debug write failed"); - writeln!(lock, $($arg)*).expect("debug write failed"); - } - } -} - -static mut DEBUG_ENABLED: bool = false; - -/// Return whether or not debug output should be enabled. -#[inline] -fn debug_enabled() -> bool { - unsafe { DEBUG_ENABLED } -} /// A program that allows you to search through all your evtc logs for specific /// people. @@ -244,8 +227,9 @@ fn main() { } if opt.debug { - // We haven't started any threads here yet, so this is fine. - unsafe { DEBUG_ENABLED = true }; + logger::initialize(log::Level::Debug); + } else { + logger::initialize(log::Level::Info); } if opt.guilds { |