doc: Update description of logging spec and ::rt module

This commit is contained in:
Brian Anderson 2012-01-19 22:27:31 -08:00
parent 8f34c15c29
commit b9d517296a
1 changed files with 17 additions and 8 deletions

View File

@ -3268,17 +3268,26 @@ The runtime contains a system for directing [logging
expressions](#log-expressions) to a logging console and/or internal logging
buffers. Logging expressions can be enabled per module.
Logging output is enabled by setting the `RUST_LOG` environment variable.
`RUST_LOG` accepts a logging specification that is a comma-separated list of
paths. For each module containing log expressions, if `RUST_LOG` contains the
path to that module or a parent of that module, then its logs will be output
to the console. The path to an module consists of the crate name, any parent
modules, then the module itself, all separated by double colons (`::`).
Logging output is enabled by setting the `RUST_LOG` environment
variable. `RUST_LOG` accepts a logging specification made up of a
comma-separated list of paths, with optional log levels. For each
module containing log expressions, if `RUST_LOG` contains the path to
that module or a parent of that module, then logs of the appropriate
level will be output to the console.
The path to a module consists of the crate name, any parent modules,
then the module itself, all separated by double colons (`::`). The
optional log level can be appended to the module path with an equals
sign (`=`) followed by the log level, from 0 to 3, inclusive. Level 0
is the error level, 1 is warning, 2 info, and 3 debug. Any logs
less than or equal to the specified level will be output. If not
specified then log level 3 is assumed.
As an example, to see all the logs generated by the compiler, you would set
`RUST_LOG` to `rustc`, which is the crate name (as specified in its `link`
[attribute](#attributes)). To narrow down the logs to just crate resolution,
you would set it to `rustc::metadata::creader`.
you would set it to `rustc::metadata::creader`. To see just error logging
use `rustc=0`.
Note that when compiling either `.rs` or `.rc` files that don't specifiy a
crate name the crate is given a default name that matches the source file,
@ -3305,7 +3314,7 @@ of runtime logging modules follows.
* `::rt::gc` Garbage collection
* `::rt::stdlib` Functions used directly by the standard library
* `::rt::kern` The runtime kernel
* `::rt::backtrace` Unused
* `::rt::backtrace` Log a backtrace on task failure
* `::rt::callback` Unused