File tree 1 file changed +22
-0
lines changed
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.
3251
3251
* ` ::rt::backtrace ` Log a backtrace on task failure
3252
3252
* ` ::rt::callback ` Unused
3253
3253
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 dubug 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 na error log\" "
3273
+ rust: ~ " \" This is a warn log\" "
3274
+ rust: ~ " \" this is an info log\" "
3275
+ ```
3254
3276
3255
3277
# Appendix: Rationales and design tradeoffs
3256
3278
You can’t perform that action at this time.
0 commit comments