Skip to content

Commit 771243d

Browse files
committed
Hint at connection between "verbose" and LevelFilter::All in example
1 parent cf3a3dd commit 771243d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

spdlog/examples/01_macro.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@ fn main() {
66
// default logger - It will be output to `stdout`.
77
info!("program started");
88

9-
let file = "config.json";
10-
119
// They will be output to `stderr`.
10+
let file = "config.json";
1211
error!("failed to open file: {}", file);
1312
warn!("undetermined locale, defaults to `en_US.UTF-8`");
1413

1514
// Level "trace" and "debug" will be ignored by default, you can modify the
1615
// level filter of the global default logger to enable all levels.
17-
spdlog::default_logger().set_level_filter(LevelFilter::All);
16+
let verbose = true;
17+
if verbose {
18+
spdlog::default_logger().set_level_filter(LevelFilter::All);
19+
}
1820

1921
trace!("position x: {}, y: {}", 11.4, -5.14);
2022
// Or if you prefer structured logging.

0 commit comments

Comments
 (0)