File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -3251,6 +3251,28 @@ of runtime logging modules follows.
32513251* ` ::rt::backtrace ` Log a backtrace on task failure
32523252* ` ::rt::callback ` Unused
32533253
3254+ #### Logging Expressions
3255+
3256+ Rust provides several macros to log information. Here's a simple Rust program
3257+ that demonstrates all four of them:
3258+
3259+ ``` rust
3260+ fn main () {
3261+ error! (" This is an error log" )
3262+ warn! (" This is a warn log" )
3263+ info! (" this is an info log" )
3264+ debug! (" This is a debug log" )
3265+ }
3266+ ```
3267+
3268+ These four log levels correspond to levels 1-4, as controlled by ` RUST_LOG ` :
3269+
3270+ ``` bash
3271+ $ RUST_LOG=rust=3 ./rust
3272+ rust: ~ " \" This is an error log\" "
3273+ rust: ~ " \" This is a warn log\" "
3274+ rust: ~ " \" this is an info log\" "
3275+ ```
32543276
32553277# Appendix: Rationales and design tradeoffs
32563278
You can’t perform that action at this time.
0 commit comments