Today, trace.Printf and trace.Debugf format the message more than once:
at least once for logging, and once for tracing.
Some of that formatting can be expensive for large messages, causing CPU
and RAM spikes due to transient allocations. So this patch makes those
trace functions only format once, and avoid the logging calls if they're
below the logging level.