extern crate ansi_term;
#[macro_use] extern crate log;
extern crate loggerv;
extern crate clap;
use clap::{Arg, App};
use loggerv::Output;
fn main() {
#[cfg(windows)] ansi_term::enable_ansi_support().unwrap();
let args = App::new("app")
.arg(Arg::with_name("v")
.short("v")
.multiple(true)
.help("Sets the level of verbosity"))
.arg(Arg::with_name("debug")
.short("d")
.long("debug")
.help("Changes the output stream for INFO, DEBUG, and TRACE from stdout to stderr."))
.get_matches();
if args.is_present("debug") {
loggerv::Logger::new()
.output(&log::Level::Info, Output::Stderr)
.output(&log::Level::Debug, Output::Stderr)
.output(&log::Level::Trace, Output::Stderr)
} else {
loggerv::Logger::new()
}.verbosity(args.occurrences_of("v"))
.init()
.unwrap();
error!("This is always printed to stderr");
warn!("This too is always printed to stderr");
info!("This is optionally printed to stdout or stderr based on the verbosity and the debug flag");
debug!("This is optionally printed to stdout or stderr based on the verbosity and the debug flag");
trace!("This is optionally printed to stdout or stderr based on the verbosity and the debug flag");
}