This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Update log message formatting.
Type: enhancement Stage:
Components: Library (Lib) Versions: Python 3.0, Python 3.1
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: LambertDW, vinay.sajip
Priority: normal Keywords:

Created on 2009-02-09 16:44 by LambertDW, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg81461 - (view) Author: David W. Lambert (LambertDW) Date: 2009-02-09 16:44
Allow logger object log message creation methods using ''.format method.

have:

logger_object.info('%s','lazy is better')
logger_object.debug('{0!s}'.format('wasted effort'))


want:

logger_object.debug('{0}','Lazy')


Work'rounds from pep282:

if log.isEnabledFor(logging.INFO):
            hamletStr = hamletDom.toxml()
            log.info(hamletStr)

or install custom Formatter.

I presume this is already on the back burner.


Incidentally, BufferingFormatter.format uses string += string instead of
''.join(list_of_strings).
msg82360 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2009-02-17 19:29
Isn't there a backward compatibility problem? If a message format string
contains both "%s" and "{0}", how is logging supposed to know what to
use - a % b or a.format(b)?

The way to do it is a custom Formatter, as you've indicated.
History
Date User Action Args
2022-04-11 14:56:45adminsetgithub: 49442
2009-02-19 12:43:06vinay.sajipsetresolution: wont fix -> rejected
2009-02-17 19:29:56vinay.sajipsetstatus: open -> closed
resolution: wont fix
messages: + msg82360
nosy: + vinay.sajip
2009-02-09 16:44:11LambertDWcreate