Issue 5192: Update log message formatting.
Issue5192
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) * ![]() |
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:45 | admin | set | github: 49442 |
| 2009-02-19 12:43:06 | vinay.sajip | set | resolution: wont fix -> rejected |
| 2009-02-17 19:29:56 | vinay.sajip | set | status: open -> closed resolution: wont fix messages: + msg82360 nosy: + vinay.sajip |
| 2009-02-09 16:44:11 | LambertDW | create | |
