pub fn default_builder() -> BuilderExpand description
Opinionated builder, with colog defaults.
This function returns a builder that:
- Uses
cologformatting - Presents messages at severity
LevelFilter::Infoand up - Optionally uses
RUST_LOGenvironment settings
let mut builder = colog::default_builder();
/* further builder setup here.. */
builder.init();
log::info!("logging is ready");Examples found in repository?
examples/levels.rs (line 5)
4fn main() {
5 let mut clog = colog::default_builder();
6 clog.filter(None, log::LevelFilter::Warn);
7 clog.init();
8 error!("error message");
9 error!("error with fmt: {}", 42);
10 warn!("warn message");
11
12 /*
13 * NOTE:
14 *
15 * The following log lines will not be printed, because the filter
16 * is set to LevelFilter::Warn
17 */
18 info!("info message");
19 debug!("debug message");
20 trace!("trace message");
21}