Skip to content

Commit df7bd10

Browse files
committed
[07 of 10]: docs: show log levels in bulleted list
The 'README.md' and crate-level API docs are both updated to show the available logging levels in a bulleted list (rather then a comma-separated list in the prose), and to note that they correspond to the externally defined log::Level enum in the 'log' crate. For the README.md file, this is an addition. The universe of valid log levels was not previously listed there. The order of the log levels is also now sorted in the list highest precedence to lowest: error, warn, info, debug, trace The previous order in which they were presented was: debug, error, info, warn, trace
1 parent d1a4dad commit df7bd10

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,17 @@ $ RUST_LOG=INFO ./main
5757
[2018-11-03T06:09:06Z INFO default] starting up
5858
```
5959

60+
The log levels that may be specified correspond to the [`log::Level`][level-enum]
61+
enum from the `log` crate. They are:
62+
63+
* `error`
64+
* `warn`
65+
* `info`
66+
* `debug`
67+
* `trace`
68+
69+
[level-enum]: https://docs.rs/log/latest/log/enum.Level.html "log::Level (docs.rs)"
70+
6071
`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.
6172

6273
### In tests

src/lib.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,18 @@
110110
//! log level is optional. If omitted, all logging for the item (and its
111111
//! children) will be enabled.
112112
//!
113-
//! When specifying a logging level, the name provided must be one of the
114-
//! strings `debug`, `error`, `info`, `warn`, or `trace`. The letter case is
115-
//! not significant for the logging level names; e.g., `debug`, `DEBUG`, and
116-
//! `dEbuG` all represent the same logging level.
113+
//! The names of the log levels that may be specified correspond to the
114+
//! variations of the [`log::Level`][level-enum] enum from the `log`
115+
//! crate. They are:
116+
//!
117+
//! * `error`
118+
//! * `warn`
119+
//! * `info`
120+
//! * `debug`
121+
//! * `trace`
122+
//!
123+
//! The letter case is not significant for the logging level names; e.g.,
124+
//! `debug`, `DEBUG`, and `dEbuG` all represent the same logging level.
117125
//!
118126
//! As the log level for a module is optional, the module to enable logging for
119127
//! is also optional. **If only a level is provided, then the global log
@@ -238,6 +246,7 @@
238246
//! ```
239247
//!
240248
//! [gh-repo-examples]: https://github.com/env-logger-rs/env_logger/tree/master/examples
249+
//! [level-enum]: https://docs.rs/log/latest/log/enum.Level.html
241250
//! [log-crate-url]: https://docs.rs/log/
242251
//! [`Builder`]: struct.Builder.html
243252
//! [`Builder::is_test`]: struct.Builder.html#method.is_test

0 commit comments

Comments
 (0)