Skip to content

Files

Latest commit

 

History

History
24 lines (14 loc) · 569 Bytes

logging-format-interpolation.md

File metadata and controls

24 lines (14 loc) · 569 Bytes

Pattern: Use of non-lazy format logging

Issue: -

Description

Used when a logging statement has a call form of logging.<logging method>(format_string.format(format_args...)). Such calls should use % formatting instead, but leave interpolation to the logging function by passing the parameters as arguments.

Example of incorrect code:

logging.warn('{0}, {1}'.format(1, 2))

Example of correct code:

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

Further Reading