New submission from Guido Kollerie <gu...@kollerie.com>:

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.

----------
messages: 153481
nosy: gkoller
priority: normal
severity: normal
status: open
title: logging module cannot format str.format log messages
type: enhancement
versions: Python 3.2

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue14031>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to