Mention lazy evaluation of log arguments in tutorial

This commit is contained in:
Tim Chevalier 2012-04-23 15:50:40 -07:00
parent 03d9d6287b
commit 55e29ef4aa

View File

@ -729,7 +729,8 @@ top-level module will be called `foo`, and you can set `RUST_LOG` to
`foo` to enable `warn`, `info` and `debug` logging for the module.
Turned-off `log` statements impose minimal overhead on the code that
contains them, so except in code that needs to be really, really fast,
contains them, because the arguments to `log` are evaluated lazily.
So except in code that needs to be really, really fast,
you should feel free to scatter around debug logging statements, and
leave them in.
@ -743,6 +744,9 @@ and will log the formatted string:
#error("fatal: %s", get_error_string());
~~~~
Because the macros `#debug`, `#warn`, and `#error` expand to calls to `log`,
their arguments are also lazily evaluated.
## Assertions
The keyword `assert`, followed by an expression with boolean type,