On Sep 30, 2009, at 1:01 PM, Antoine Pitrou wrote: > Why not allow logging.Formatter to take a callable, which would in > turn call the > callable with keyword arguments? > > Therefore, you could write: > logging.Formatter("{asctime} - {name} - {level} - {msg}".format) This is a very interesting idea. Note that one of the reasons to /at least/ support {}-strings also is that %-strings are simply too error prone in many situations. For example, if I decide to support internationalization of log format strings, and all I can use is %-strings, it's almost guaranteed that I will have bugs because a translator forgot the trailing 's'. This exactly the motivation that led to PEP 292 $-strings. In fact, while we're at it, it would be kind of cool if I could use $- strings in log templates. Antoine's idea of accepting a callable might fit that bill nicely. -Barry -------------- next part -------------- A non-text attachment was scrubbed... Name: PGP.sig Type: application/pgp-signature Size: 832 bytes Desc: This is a digitally signed message part URL: <http://mail.python.org/pipermail/python-dev/attachments/20090930/c8c788f5/attachment.pgp>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4