Skip to content

Commit 484ca2b

Browse files
committed
[08 of 10]: document 'OFF' pseudo log level feature
1 parent df7bd10 commit 484ca2b

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ enum from the `log` crate. They are:
6868

6969
[level-enum]: https://docs.rs/log/latest/log/enum.Level.html "log::Level (docs.rs)"
7070

71+
There is also a pseudo logging level, `off`, which may be specified to disable
72+
all logging for a given module or for the entire application. As with the
73+
logging levels, the letter case is not significant.
74+
7175
`env_logger` can be configured in other ways besides an environment variable. See [the examples](https://github.com/env-logger-rs/env_logger/tree/master/examples) for more approaches.
7276

7377
### In tests

src/lib.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,19 +123,30 @@
123123
//! The letter case is not significant for the logging level names; e.g.,
124124
//! `debug`, `DEBUG`, and `dEbuG` all represent the same logging level.
125125
//!
126+
//! There is also a pseudo logging level, `off`, which may be specified to
127+
//! disable all logging for a given module or for the entire application. As
128+
//! with the logging levels, the letter case is not significant[^fn-off].
129+
//!
130+
//! [^fn-off]: Similar to the universe of log level names, the `off` pseudo
131+
//! log level feature is also provided by the underlying `log` crate.
132+
//!
126133
//! As the log level for a module is optional, the module to enable logging for
127134
//! is also optional. **If only a level is provided, then the global log
128135
//! level for all modules is set to this value.**
129136
//!
130137
//! Some examples of valid values of `RUST_LOG` are:
131138
//!
132139
//! * `hello` turns on all logging for the 'hello' module
140+
//! * `trace` turns on all logging for the application, regardless of its name
141+
//! * `TRACE` turns on all logging for the application, regardless of its name (same as previous)
133142
//! * `info` turns on all info logging
134143
//! * `INFO` turns on all info logging (same as previous)
135144
//! * `hello=debug` turns on debug logging for 'hello'
136145
//! * `hello=DEBUG` turns on debug logging for 'hello' (same as previous)
137146
//! * `hello,std::option` turns on hello, and std's option logging
138147
//! * `error,hello=warn` turn on global error logging and also warn for hello
148+
//! * `error,hello=off`` turn on global error logging, but turn off logging for hello
149+
//! * `OFF` turns off all logging for the application
139150
//!
140151
//! ## Filtering results
141152
//!

0 commit comments

Comments
 (0)