Skip to content

Commit

Permalink
[8 of 9]: document 'OFF' pseudo log level feature
Browse files Browse the repository at this point in the history
  • Loading branch information
salewski committed Dec 5, 2020
1 parent c91e2b1 commit 236497b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -68,6 +68,10 @@ enum from the `log` crate. They are:

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

There is also a pseudo logging level, `OFF`, which may be specified to disable
all logging for a given module or for the entire application. As with the
logging levels, the letter case is not significant.

`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.

### In tests
Expand Down
11 changes: 11 additions & 0 deletions src/lib.rs
Expand Up @@ -123,19 +123,30 @@
//! The letter case is not significant for the logging level names; e.g.,
//! `debug`, `DEBUG`, and `dEbuG` all represent the same logging level.
//!
//! There is also a pseudo logging level, `OFF`, which may be specified to
//! disable all logging for a given module or for the entire application. As
//! with the logging levels, the letter case is not significant[^fn-off].
//!
//! [^fn-off]: Similar to the universe of log level names, the `OFF` pseudo
//! log level feature is also provided by the underlying `log` crate.
//!
//! As the log level for a module is optional, the module to enable logging for
//! is also optional. **If only a level is provided, then the global log
//! level for all modules is set to this value.**
//!
//! Some examples of valid values of `RUST_LOG` are:
//!
//! * `hello` turns on all logging for the 'hello' module
//! * `trace` turns on all logging for the application, regardless of its name
//! * `TRACE` turns on all logging for the application, regardless of its name (same as previous)
//! * `info` turns on all info logging
//! * `INFO` turns on all info logging (same as previous)
//! * `hello=debug` turns on debug logging for 'hello'
//! * `hello=DEBUG` turns on debug logging for 'hello' (same as previous)
//! * `hello,std::option` turns on hello, and std's option logging
//! * `error,hello=warn` turn on global error logging and also warn for hello
//! * `error,hello=off`` turn on global error logging, but turn off logging for hello
//! * `OFF` turns off all logging for the application
//!
//! ## Filtering results
//!
Expand Down

0 comments on commit 236497b

Please sign in to comment.