-
Task
-
Resolution: Done
-
Normal
-
6.10
-
None
-
False
-
False
For log messages, you can do lazy evaluation of the format string to occasionally boost performance when a log message is not used. For instance:
class Hypothetical(object):
def str(self):
return self.calculate_fibonacci_10000()
log.debug("10,000th fibonacci number is: %s", Hypothetical())
The format string will not be interpolated (and thus the 10,000th fibonacci number will not be calculated) unless we are actually going to log the debug() output.
The code in commit b870460 broke that because it calculated its own format string and args for the message, interfering with whatever was passed in via function parameter.
- clones
-
RHELC-628 Fix lazy log evaluation for debug logging - el7
- Closed