Skip to content

Commit b9d5172

Browse files
committed
doc: Update description of logging spec and ::rt module
1 parent 8f34c15 commit b9d5172

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

doc/rust.md

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3268,17 +3268,26 @@ The runtime contains a system for directing [logging
32683268
expressions](#log-expressions) to a logging console and/or internal logging
32693269
buffers. Logging expressions can be enabled per module.
32703270

3271-
Logging output is enabled by setting the `RUST_LOG` environment variable.
3272-
`RUST_LOG` accepts a logging specification that is a comma-separated list of
3273-
paths. For each module containing log expressions, if `RUST_LOG` contains the
3274-
path to that module or a parent of that module, then its logs will be output
3275-
to the console. The path to an module consists of the crate name, any parent
3276-
modules, then the module itself, all separated by double colons (`::`).
3271+
Logging output is enabled by setting the `RUST_LOG` environment
3272+
variable. `RUST_LOG` accepts a logging specification made up of a
3273+
comma-separated list of paths, with optional log levels. For each
3274+
module containing log expressions, if `RUST_LOG` contains the path to
3275+
that module or a parent of that module, then logs of the appropriate
3276+
level will be output to the console.
3277+
3278+
The path to a module consists of the crate name, any parent modules,
3279+
then the module itself, all separated by double colons (`::`). The
3280+
optional log level can be appended to the module path with an equals
3281+
sign (`=`) followed by the log level, from 0 to 3, inclusive. Level 0
3282+
is the error level, 1 is warning, 2 info, and 3 debug. Any logs
3283+
less than or equal to the specified level will be output. If not
3284+
specified then log level 3 is assumed.
32773285

32783286
As an example, to see all the logs generated by the compiler, you would set
32793287
`RUST_LOG` to `rustc`, which is the crate name (as specified in its `link`
32803288
[attribute](#attributes)). To narrow down the logs to just crate resolution,
3281-
you would set it to `rustc::metadata::creader`.
3289+
you would set it to `rustc::metadata::creader`. To see just error logging
3290+
use `rustc=0`.
32823291

32833292
Note that when compiling either `.rs` or `.rc` files that don't specifiy a
32843293
crate name the crate is given a default name that matches the source file,
@@ -3305,7 +3314,7 @@ of runtime logging modules follows.
33053314
* `::rt::gc` Garbage collection
33063315
* `::rt::stdlib` Functions used directly by the standard library
33073316
* `::rt::kern` The runtime kernel
3308-
* `::rt::backtrace` Unused
3317+
* `::rt::backtrace` Log a backtrace on task failure
33093318
* `::rt::callback` Unused
33103319

33113320

0 commit comments

Comments
 (0)