|
32 | 32 | //!
|
33 | 33 | //! Assumes the binary is `main`:
|
34 | 34 | //!
|
35 |
| -//! ```{.bash} |
| 35 | +//! ```console |
36 | 36 | //! $ RUST_LOG=error ./main
|
37 | 37 | //! [2017-11-09T02:12:24Z ERROR main] this is printed by default
|
38 | 38 | //! ```
|
39 | 39 | //!
|
40 |
| -//! ```{.bash} |
| 40 | +//! ```console |
41 | 41 | //! $ RUST_LOG=info ./main
|
42 | 42 | //! [2017-11-09T02:12:24Z ERROR main] this is printed by default
|
43 | 43 | //! [2017-11-09T02:12:24Z INFO main] the answer was: 12
|
44 | 44 | //! ```
|
45 | 45 | //!
|
46 |
| -//! ```{.bash} |
| 46 | +//! ```console |
47 | 47 | //! $ RUST_LOG=debug ./main
|
48 | 48 | //! [2017-11-09T02:12:24Z DEBUG main] this is a debug message
|
49 | 49 | //! [2017-11-09T02:12:24Z ERROR main] this is printed by default
|
|
52 | 52 | //!
|
53 | 53 | //! You can also set the log level on a per module basis:
|
54 | 54 | //!
|
55 |
| -//! ```{.bash} |
| 55 | +//! ```console |
56 | 56 | //! $ RUST_LOG=main=info ./main
|
57 | 57 | //! [2017-11-09T02:12:24Z ERROR main] this is printed by default
|
58 | 58 | //! [2017-11-09T02:12:24Z INFO main] the answer was: 12
|
59 | 59 | //! ```
|
60 | 60 | //!
|
61 | 61 | //! And enable all logging:
|
62 | 62 | //!
|
63 |
| -//! ```{.bash} |
| 63 | +//! ```console |
64 | 64 | //! $ RUST_LOG=main ./main
|
65 | 65 | //! [2017-11-09T02:12:24Z DEBUG main] this is a debug message
|
66 | 66 | //! [2017-11-09T02:12:24Z ERROR main] this is printed by default
|
|
70 | 70 | //! If the binary name contains hyphens, you will need to replace
|
71 | 71 | //! them with underscores:
|
72 | 72 | //!
|
73 |
| -//! ```{.bash} |
| 73 | +//! ```console |
74 | 74 | //! $ RUST_LOG=my_app ./my-app
|
75 | 75 | //! [2017-11-09T02:12:24Z DEBUG my_app] this is a debug message
|
76 | 76 | //! [2017-11-09T02:12:24Z ERROR my_app] this is printed by default
|
|
88 | 88 | //! **By default all logging is disabled except for the `error` level**
|
89 | 89 | //!
|
90 | 90 | //! The **`RUST_LOG`** environment variable controls logging with the syntax:
|
91 |
| -//! ```text |
| 91 | +//! ```console |
92 | 92 | //! RUST_LOG=[target][=][level][,...]
|
93 | 93 | //! ```
|
94 | 94 | //! Or in other words, its a comma-separated list of directives.
|
95 | 95 | //! Directives can filter by **target**, by **level**, or both (using `=`).
|
96 | 96 | //!
|
97 | 97 | //! For example,
|
98 |
| -//! ```text |
| 98 | +//! ```console |
99 | 99 | //! RUST_LOG=data=debug,hardware=debug
|
100 | 100 | //! ```
|
101 | 101 | //!
|
|
0 commit comments