tgavankar/kitsune — comment on commit 6816429d431c5b5a715330b43595f43202e18bc4
File: apps/upload/tasks.py line 116
By willkg:

The Python logger handles string interpolation on its own. So instead of doing this, it's better to do this:

log.info('File is not a PNG for: %s %d, %s', for_obj.__class__.__name__, for_obj.id, for_field)

Note no use of % or .format.

Alternatively, I think you can also do:

log.info('File is not a PNG for: %(model)s %(id)d, %(forf)s', {'model': for_obj.__class__.__name__, 'id': for_obj.id, 'forf': for_field})

One of the reasons to do this is that it pushes string interpolation off until the logging record is definitely being emitted. Also, it makes the message and args available for anything downstream that's doing things with logging messages. I'm not sure offhand if Kitsune has any of those. If not, then this might be mildly moot.