diff options
author | Raymond Hettinger <python@rcn.com> | 2011-02-17 19:19:44 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2011-02-17 19:19:44 (GMT) |
commit | 03a6e6630bd9ac8c46e7362b7d868b4db26dd74b (patch) | |
tree | cb0398b6b7e0e7fa51102881a57da619bf336d8d /Doc | |
parent | 4a8f50a85c111e6a84802971bb7f02eaaff466f0 (diff) | |
download | cpython-03a6e6630bd9ac8c46e7362b7d868b4db26dd74b.zip cpython-03a6e6630bd9ac8c46e7362b7d868b4db26dd74b.tar.gz cpython-03a6e6630bd9ac8c46e7362b7d868b4db26dd74b.tar.bz2 |
Fix-up logging.dictConfig() example.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/whatsnew/3.2.rst | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Doc/whatsnew/3.2.rst b/Doc/whatsnew/3.2.rst index 8f7b03e..b57a725 100644 --- a/Doc/whatsnew/3.2.rst +++ b/Doc/whatsnew/3.2.rst @@ -193,7 +193,7 @@ dictionary:: {"version": 1, "formatters": {"brief": {"format": "%(levelname)-8s: %(name)-15s: %(message)s"}, - "full": {"format": "%(asctime)s %(name)-15s %(levelname)-8s %(message)s"}, + "full": {"format": "%(asctime)s %(name)-15s %(levelname)-8s %(message)s"} }, "handlers": {"console": { "class": "logging.StreamHandler", @@ -204,7 +204,7 @@ dictionary:: "class": "logging.StreamHandler", "formatter": "full", "level": "ERROR", - "stream": "ext://sys.stderr"}, + "stream": "ext://sys.stderr"} }, "root": {"level": "DEBUG", "handlers": ["console", "console_priority"]}} @@ -213,11 +213,13 @@ If that dictionary is stored in a file called :file:`conf.json`, it can be loaded and called with code like this:: >>> import json, logging.config - >>> with open('conf.json', 'rb') as f: + >>> with open('conf.json') as f: conf = json.load(f) >>> logging.config.dictConfig(conf) >>> logging.info("Transaction completed normally") + INFO : root : Transaction completed normally >>> logging.critical("Abnormal termination") + 2011-02-17 11:14:36,694 root CRITICAL Abnormal termination .. seealso:: |