mirror of
https://github.com/ratatui-org/ratatui
synced 2024-11-10 15:14:27 +00:00
[dependencies] Replace log4rs by stderrlog
This commit is contained in:
parent
3012215e32
commit
e675d6735c
3 changed files with 7 additions and 32 deletions
|
@ -26,7 +26,7 @@ termion = { version = "1.4.0", optional = true }
|
|||
rustbox = { version = "0.9.0", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
log4rs = "0.5.2"
|
||||
stderrlog = "0.2"
|
||||
rand = "0.3.15"
|
||||
|
||||
[[example]]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#[macro_use]
|
||||
extern crate log;
|
||||
|
||||
extern crate stderrlog;
|
||||
extern crate termion;
|
||||
extern crate tui;
|
||||
|
||||
|
@ -8,7 +8,6 @@ mod util;
|
|||
|
||||
use std::io;
|
||||
use std::thread;
|
||||
use std::env;
|
||||
use std::time;
|
||||
use std::sync::mpsc;
|
||||
|
||||
|
@ -57,12 +56,11 @@ enum Event {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
for argument in env::args() {
|
||||
if argument == "--log" {
|
||||
setup_log("demo.log");
|
||||
}
|
||||
}
|
||||
|
||||
stderrlog::new()
|
||||
.module(module_path!())
|
||||
.verbosity(4)
|
||||
.init()
|
||||
.unwrap();
|
||||
info!("Start");
|
||||
|
||||
let mut rand_signal = RandomSignal::new(0, 100);
|
||||
|
|
|
@ -1,32 +1,9 @@
|
|||
#![allow(dead_code)]
|
||||
|
||||
extern crate log4rs;
|
||||
extern crate log;
|
||||
extern crate rand;
|
||||
|
||||
use self::rand::distributions::{IndependentSample, Range};
|
||||
|
||||
use self::log::LogLevelFilter;
|
||||
use self::log4rs::append::file::FileAppender;
|
||||
use self::log4rs::encode::pattern::PatternEncoder;
|
||||
use self::log4rs::config::{Appender, Config, Root};
|
||||
|
||||
pub fn setup_log(file_name: &str) {
|
||||
let log = FileAppender::builder()
|
||||
.encoder(Box::new(PatternEncoder::new(
|
||||
"{l} / {d(%H:%M:%S)} / \
|
||||
{M}:{L}{n}{m}{n}{n}",
|
||||
)))
|
||||
.build(file_name)
|
||||
.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();
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct RandomSignal {
|
||||
range: Range<u64>,
|
||||
|
|
Loading…
Reference in a new issue