Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add information about logging macros to the tutorial. #5703

Merged
merged 3 commits into from
Apr 4, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions doc/rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -3251,6 +3251,28 @@ of runtime logging modules follows.
* `::rt::backtrace` Log a backtrace on task failure
* `::rt::callback` Unused

#### Logging Expressions

Rust provides several macros to log information. Here's a simple Rust program
that demonstrates all four of them:

```rust
fn main() {
error!("This is an error log")
warn!("This is a warn log")
info!("this is an info log")
debug!("This is a debug log")
}
```

These four log levels correspond to levels 1-4, as controlled by `RUST_LOG`:

```bash
$ RUST_LOG=rust=3 ./rust
rust: ~"\"This is an error log\""
rust: ~"\"This is a warn log\""
rust: ~"\"this is an info log\""
```

# Appendix: Rationales and design tradeoffs

Expand Down