Skip to content

Commit 5595a4d

Browse files
committed
[10 of 10]: docs: explain use of lower case log level names
Since our convention throughout the docs is to use the lower case form of log level names (e.g., "info" rather than "INFO"), users might mistakenly infer that we are implying that only the lower case forms are legit. Careful readers might even suspect that the handful of departures are typos rather than deliberate examples. This change adds a blurblet to the README.md and to the top-level API docs explaining the convention and the motivation for using it (consistency).
1 parent b844d58 commit 5595a4d

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

README.md

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

60+
So which form should you use? For consistency, our convention is to use lower
61+
case names. Where our docs do use other forms, they do so in the context of
62+
specific examples, so you won't be surprised if you see similar usage in the
63+
wild.
64+
6065
The log levels that may be specified correspond to the [`log::Level`][level-enum]
6166
enum from the `log` crate. They are:
6267

src/lib.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,16 +120,19 @@
120120
//! * `debug`
121121
//! * `trace`
122122
//!
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.
125-
//!
126123
//! There is also a pseudo logging level, `off`, which may be specified to
127124
//! disable all logging for a given module or for the entire application. As
128125
//! with the logging levels, the letter case is not significant[^fn-off].
129126
//!
130127
//! [^fn-off]: Similar to the universe of log level names, the `off` pseudo
131128
//! log level feature is also provided by the underlying `log` crate.
132129
//!
130+
//! The letter case is not significant for the logging level names; e.g.,
131+
//! `debug`, `DEBUG`, and `dEbuG` all represent the same logging level. For
132+
//! consistency, our convention is to use the lower case names. Where our docs
133+
//! do use other forms, they do so in the context of specific examples, so you
134+
//! won't be surprised if you see similar usage in the wild.
135+
//!
133136
//! As the log level for a module is optional, the module to enable logging for
134137
//! is also optional. **If only a level is provided, then the global log
135138
//! level for all modules is set to this value.**
@@ -146,7 +149,8 @@
146149
//! * `hello,std::option` turns on hello, and std's option logging
147150
//! * `error,hello=warn` turn on global error logging and also warn for hello
148151
//! * `error,hello=off`` turn on global error logging, but turn off logging for hello
149-
//! * `OFF` turns off all logging for the application
152+
//! * `off` turns off all logging for the application
153+
//! * `OFF` turns off all logging for the application (same as previous)
150154
//!
151155
//! ## Filtering results
152156
//!

0 commit comments

Comments
 (0)