On Thu, Feb 10, 2011 at 7:20 PM, raymond.hettinger <python-check...@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 | ncogh...@gmail.com | Brisbane, Australia _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com