Add a way to disable logging in the demo

This commit is contained in:
Florian Dehau 2016-11-03 00:11:06 +01:00
parent d42dfaa710
commit dce4bf15b7

View file

@ -6,6 +6,7 @@ extern crate termion;
extern crate rand;
use std::thread;
use std::env;
use std::time;
use std::sync::mpsc;
use std::io::stdin;
@ -118,17 +119,23 @@ enum Event {
fn main() {
for argument in env::args() {
if argument == "--log" {
let log = FileAppender::builder()
.encoder(Box::new(PatternEncoder::new("{l} / {d(%H:%M:%S)} / {M}:{L}{n}{m}{n}{n}")))
.build("prototype.log")
.encoder(Box::new(PatternEncoder::new("{l} / {d(%H:%M:%S)} / \
{M}:{L}{n}{m}{n}{n}")))
.build("demo.log")
.unwrap();
let config = Config::builder()
.appender(Appender::builder().build("log", Box::new(log)))
.build(Root::builder().appender("log").build(LogLevelFilter::Debug))
.unwrap();
log4rs::init_config(config).unwrap();
}
}
info!("Start");
let mut rand_signal = RandomSignal::new(Range::new(0, 100));