filtered_output/
filtered-output.rs1use traccia::{debug, error, fatal, info, Console, LogLevel, Output};
2
3fn main() {
4 traccia::init_with_config(traccia::Config {
5 level: LogLevel::Debug,
6 targets: vec![Box::new(
7 Console::new()
8 .filtered_output(LogLevel::Error, Output::Stderr)
9 .filtered_output(LogLevel::Fatal, Output::Stderr),
10 )],
11 ..Default::default()
12 });
13
14 debug!("This will be logged to stdout");
15 info!("In fact, only error and fatal messages will be logged to stderr.");
16
17 error!("This is an error logged to stderr!!!");
18 fatal!("This is a fatal error logged to stderr!!!");
19}