[−][src]Macro tao_log::logv
Log an expression and its value at any specified level.
Logs with the optional or default (module path of use) target, specified
Level
, optional prefix, and optional or default ("{:?}"
) value format
string, and a single expression. The expression argument is evaluated
exactly once, regardless of if the logging level is enabled, and its
value is returned from the macro. This is normally only used through the
-v macros like debugv!
or tracev!
.
Note that the value is moved and then returned. If the type does not
implement Copy
, ownership may be retained by borrowing by reference
e.g. debugv!(&expr)
.
Examples
use tao_log::*; #[derive(Debug)] struct Point { x: f32, y: f32 } fn circle(center: &Point, radius: f32) { /*...*/ } let center = Point { x: 3.234, y: -1.223 }; circle(logv!(log::Level::Trace, ¢er), 7.3); // ^-- trace level message: "¢er → Point { x: 3.234, y: -1.223 }" circle(tracev!(¢er), 8.0); // ^-- trace level message: "¢er → Point { x: 3.234, y: -1.223 }"