Edgewall Software

Opened 10 years ago

Last modified 9 years ago

#11765 closed defect

[PATCH] Avoid string interpolation in logging calls — at Initial Version

Reported by: Alex Willmer <al.willmer@…> Owned by:
Priority: low Milestone: 1.0.3
Component: general Version:
Severity: minor Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

When using Python's stdlib logging it's better to delegate string formatting to the loggging package - rather than use %-interpolation directly. This saves a few CPU cycles when the configured log level would discard that log message. Instead of

self.log.debug("Sendmail command line: %s" % cmdline)

use

self.log.debug("Sendmail command line: %s", cmdline)

Attached is a patch to fix this in 0.12.x. If theres interest I can update for 1.0.x and trunk.

Change History (1)

by Alex Willmer <al.willmer@…>, 10 years ago

Note: See TracTickets for help on using tickets.