2020-06-24 16:17:59 +02:00
|
|
|
use std::io::Write;
|
|
|
|
|
2018-08-21 14:10:57 +02:00
|
|
|
extern crate watchexec;
|
2019-01-26 03:15:27 +01:00
|
|
|
|
2018-09-08 13:51:44 +02:00
|
|
|
use watchexec::{cli, error, run};
|
2016-09-14 15:30:59 +02:00
|
|
|
|
2018-09-08 13:51:44 +02:00
|
|
|
fn main() -> error::Result<()> {
|
2021-04-10 15:09:28 +02:00
|
|
|
#[allow(deprecated)]
|
|
|
|
let (args, loglevel) = cli::get_args()?;
|
|
|
|
init_logger(loglevel);
|
2020-06-25 12:16:22 +02:00
|
|
|
run(args)
|
2017-01-27 21:27:44 +01:00
|
|
|
}
|
2020-06-24 16:17:59 +02:00
|
|
|
|
2021-04-08 19:52:44 +02:00
|
|
|
fn init_logger(level: log::LevelFilter) {
|
2020-06-24 16:17:59 +02:00
|
|
|
let mut log_builder = env_logger::Builder::new();
|
|
|
|
|
|
|
|
log_builder
|
|
|
|
.format(|buf, r| writeln!(buf, "*** {}", r.args()))
|
|
|
|
.filter(None, level)
|
|
|
|
.init();
|
|
|
|
}
|