Message153481
When logging messages with variable data one typically writes:
username = 'Guido'
logging.info('User %s logged in', username)
However Python 3 has support str.format (PEP 3101). If one has adopted str.format for formatting strings in Python 3 code one should also be able to write the above as:
logging.info('User {} logged in', username)
However this currently is not supported. For backwards compatibility,% style logging should remain the default. However when a logger is configured using:
import logging
logging.basicConfig(style='{', format='{levelname}:{message}')
all subsequent calls to logging.debug, logging.info, logging.warning, logging.error, logging.critical, logging.exception and logging.log should use str.format for formatting. |
|
Date |
User |
Action |
Args |
2012-02-16 15:20:49 | gkoller | set | recipients:
+ gkoller |
2012-02-16 15:20:49 | gkoller | set | messageid: <1329405649.45.0.0231002086589.issue14031@psf.upfronthosting.co.za> |
2012-02-16 15:20:48 | gkoller | link | issue14031 messages |
2012-02-16 15:20:48 | gkoller | create | |
|