Skip to content

Files

Latest commit

 

History

History
24 lines (14 loc) · 613 Bytes

logging-not-lazy.md

File metadata and controls

24 lines (14 loc) · 613 Bytes

Pattern: Use of non-lazy logging

Issue: -

Description

Used when a logging statement has a call form of logging.<logging method>(format_string % (format_args...)). Such calls should leave string interpolation to the logging method itself so that the program may avoid incurring the cost of the interpolation in those cases in which no message will be logged.

Example of incorrect code:

logging.warn('%s, %s' % (1, 2))

Example of correct code:

logging.warn('%s, %s', 1, 2)

Further Reading