log: differ formatted args evaluation
When the format_args!
macro is used, formatted args are evaluated
in order to form the argument collection that ends up being formatted
when requested to do so.
For the log macro, this means that any argument that is an expression was evaluated even if the log level was below current threshold. This can be examplified by the following code:
gst::debug!(CAT, "{}", {
println!("fmt arg executed");
"A debug log"
});
This used to print "fmt arg executed" even when the log threshold for
CAT
was filtering debug
out.
Note that this could break existing code that would incorrectly rely on the side effect.