mirror of
https://github.com/sigoden/dufs.git
synced 2026-04-09 00:59:02 +03:00
feat: aware RUST_LOG
This commit is contained in:
18
src/main.rs
18
src/main.rs
@@ -25,14 +25,18 @@ async fn main() {
|
||||
async fn run() -> BoxResult<()> {
|
||||
let args = Args::parse(matches())?;
|
||||
|
||||
let level = if args.log {
|
||||
LevelFilter::Info
|
||||
if std::env::var("RUST_LOG").is_ok() {
|
||||
simple_logger::init()?;
|
||||
} else {
|
||||
LevelFilter::Error
|
||||
};
|
||||
simple_logger::SimpleLogger::default()
|
||||
.with_level(level)
|
||||
.init()?;
|
||||
let level = if args.log {
|
||||
LevelFilter::Info
|
||||
} else {
|
||||
LevelFilter::Error
|
||||
};
|
||||
simple_logger::SimpleLogger::default()
|
||||
.with_level(level)
|
||||
.init()?;
|
||||
}
|
||||
serve(args).await
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user