summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2010-10-31 14:59:16 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2010-10-31 14:59:16 (GMT)
commitc5b273011b86d6ec534c935d4520c5db5a35bde1 (patch)
tree558d7305d73c76a8646ff8b00911765f9db5682e /Lib
parent64474542ebec7095d3f66828de4d917699388e9e (diff)
downloadcpython-c5b273011b86d6ec534c935d4520c5db5a35bde1.zip
cpython-c5b273011b86d6ec534c935d4520c5db5a35bde1.tar.gz
cpython-c5b273011b86d6ec534c935d4520c5db5a35bde1.tar.bz2
Added style argument to logging.basicConfig() and documented this change.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/logging/__init__.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
index 37c78cb..f03d9f2 100644
--- a/Lib/logging/__init__.py
+++ b/Lib/logging/__init__.py
@@ -1581,6 +1581,10 @@ def basicConfig(**kwargs):
(if filemode is unspecified, it defaults to 'a').
format Use the specified format string for the handler.
datefmt Use the specified date/time format.
+ style If a format string is specified, use this to specify the
+ type of format string (possible values '%', '{', '$', for
+ %-formatting, :meth:`str.format` and :class:`string.Template`
+ - defaults to '%').
level Set the root logger level to the specified level.
stream Use the specified stream to initialize the StreamHandler. Note
that this argument is incompatible with 'filename' - if both
@@ -1591,6 +1595,9 @@ def basicConfig(**kwargs):
remembered that StreamHandler does not close its stream (since it may be
using sys.stdout or sys.stderr), whereas FileHandler closes its stream
when the handler is closed.
+
+ .. versionchanged: 3.2
+ Added the ``style`` parameter.
"""
# Add thread safety in case someone mistakenly calls
# basicConfig() from multiple threads
@@ -1606,7 +1613,8 @@ def basicConfig(**kwargs):
hdlr = StreamHandler(stream)
fs = kwargs.get("format", BASIC_FORMAT)
dfs = kwargs.get("datefmt", None)
- fmt = Formatter(fs, dfs)
+ style = kwargs.get("style", '%')
+ fmt = Formatter(fs, dfs, style)
hdlr.setFormatter(fmt)
root.addHandler(hdlr)
level = kwargs.get("level")