Skip to content

Commit 0dd4b42

Browse files
committed
Fix nits in logging section.
1 parent 2f50607 commit 0dd4b42

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

doc/rust.md

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2306,30 +2306,25 @@ logging level:
23062306
// Full version, logging a value.
23072307
log(core::error, ~"file not found: " + filename);
23082308
2309-
// Log-level abbreviated, since core::* is imported by default.
2309+
// Log-level abbreviated, since core::* is used by default.
23102310
log(error, ~"file not found: " + filename);
23112311
2312-
// Formatting the message using a format-string and #fmt
2312+
// Formatting the message using a format-string and fmt!
23132313
log(error, fmt!("file not found: %s", filename));
23142314
2315-
// Using the #error macro, that expands to the previous call.
2315+
// Using the error! macro, that expands to the previous call.
23162316
error!("file not found: %s", filename);
23172317
~~~~
23182318

2319-
A `log` expression is *not evaluated* when logging at the specified
2320-
logging-level, module or task is disabled at runtime. This makes inactive
2321-
`log` expressions very cheap; they should be used extensively in Rust
2322-
code, as diagnostic aids, as they add little overhead beyond a single
2323-
integer-compare and branch at runtime.
2324-
2325-
Logging is presently implemented as a language built-in feature, as it makes
2326-
use of compiler-provided logic for allocating the associated per-module
2327-
logging-control structures visible to the runtime, and lazily evaluating
2328-
arguments. In the future, as more of the supporting compiler-provided logic is
2329-
moved into libraries, logging is likely to move to a component of the core
2330-
library. It is best to use the macro forms of logging (*#error*,
2331-
*#debug*, etc.) to minimize disruption to code using the logging facility
2332-
when it is changed.
2319+
A `log` expression is *not evaluated* when logging at the specified logging-level, module or task is disabled at runtime.
2320+
This makes inactive `log` expressions very cheap;
2321+
they should be used extensively in Rust code, as diagnostic aids,
2322+
as they add little overhead beyond a single integer-compare and branch at runtime.
2323+
2324+
Logging is presently implemented as a language built-in feature,
2325+
as it makes use of compiler-provided, per-module data tables and flags.
2326+
In the future, logging will move into a library, and will no longer be a core expression type.
2327+
It is therefore recommended to use the macro forms of logging (`error!`, `debug!`, etc.) to minimize disruption in code that uses logging.
23332328

23342329

23352330
### Assert expressions

0 commit comments

Comments
 (0)