estk / log4rs

A highly configurable logging framework for Rust
Apache License 2.0
997 stars 147 forks source link

filter log messages based on module, when using the json logger format. #396

Open madelaney opened 3 days ago

madelaney commented 3 days ago

I was looking at json_logger.rs, but it was unclear how I can filter the messages based on the module. For example, if I just want the module that is setting up log4rs to actually log messages.

madelaney commented 3 days ago

I found out I can do something like .logger(Logger::builder().build("other_module", LevelFilter::Off)), but I'm still curious if I can turn off everything except the root module without having to list the other modules.