设置日志 log 级别

Signed-off-by: Jia Chao <jiac13@chinaunicom.cn>
This commit is contained in:
Jia Chao 2024-07-12 10:52:04 +08:00
parent 1bf5868fce
commit c614e68280
2 changed files with 16 additions and 2 deletions

View File

@ -3,3 +3,17 @@ pub use ccutils::Result;
mod cli;
mod config;
mod syncer;
pub fn cumain() -> Result<()> {
let cli = cli::parse();
// 设置日志级别
match (cli.debug, cli.quiet) {
(true, _) => std::env::set_var("RUST_LOG", "debug"),
(false, true) => std::env::set_var("RUST_LOG", "error"),
_ => {},
}
ccutils::set_up_logging()?;
Ok(())
}

View File

@ -1,3 +1,3 @@
fn main() {
println!("Hello, world!");
fn main() -> cuweb_syncer::Result<()> {
cuweb_syncer::cumain()
}