On Thu, Feb 10, 2011 at 7:20 PM, raymond.hettinger <python-checkins at python.org> wrote: > +The :func:`logging.basicConfig` set-up function gained a *style* argument to > +support three different types of string formatting. It defaults to "%" for > +traditional %-formatting, can be set to "{" for the new :meth:`str.format` style, or > +can be set to "$" for the shell-style formatting provided by > +:class:`string.Template`. The following three configurations are equivalent:: > + > + >>> from logging import basicConfig > + >>> basicConfig(style='%', format="%(name)s -> %(levelname)s: %(message)s") > + >>> basicConfig(style='{', format="{name} -> {levelname} {message}") > + >>> basicConfig(style='$', format="$name -> $levelname: $message") It may be worth noting here that: 1. the "style" parameter also exists for logging.Formatter objects 2. it only applies to the output formatting for output, individual logging calls are still constrained to using %-formatting by backwards compatibility issues (Especially point 2 - I briefly forgot that distinction myself, and I helped review this feature when Vinay added it) Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
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