[Python-checkins] cpython (merge 3.3 -> default): Merged doc update from 3.3.

vinay.sajip python-checkins at python.org
Wed Jan 23 10:32:49 CET 2013


http://hg.python.org/cpython/rev/02e7da4c4fe3
changeset:   81673:02e7da4c4fe3
parent:      81669:7b51568cfbae
parent:      81672:ea459f70e258
user:        Vinay Sajip <vinay_sajip at yahoo.co.uk>
date:        Wed Jan 23 09:32:32 2013 +0000
summary:
  Merged doc update from 3.3.

files:
  Doc/howto/logging-cookbook.rst |  11 +++++++++--
  1 files changed, 9 insertions(+), 2 deletions(-)


diff --git a/Doc/howto/logging-cookbook.rst b/Doc/howto/logging-cookbook.rst
--- a/Doc/howto/logging-cookbook.rst
+++ b/Doc/howto/logging-cookbook.rst
@@ -1620,7 +1620,7 @@
 Although most logging messages are intended for reading by humans, and thus not
 readily machine-parseable, there might be cirumstances where you want to output
 messages in a structured format which *is* capable of being parsed by a program
-(without needed complex regular expressions to parse the log message). This is
+(without needing complex regular expressions to parse the log message). This is
 straightforward to achieve using the logging package. There are a number of
 ways in which this could be achieved, but the following is a simple approach
 which uses JSON to serialise the event in a machine-parseable manner::
@@ -1645,6 +1645,9 @@
 
     message 1 >>> {"fnum": 123.456, "num": 123, "bar": "baz", "foo": "bar"}
 
+Note that the order of items might be different according to the version of
+Python used.
+
 If you need more specialised processing, you can use a custom JSON encoder,
 as in the following complete example::
 
@@ -1653,6 +1656,7 @@
     import json
     import logging
 
+    # This next bit is to ensure the script runs unchanged on 2.x and 3.x
     try:
         unicode
     except NameError:
@@ -1675,7 +1679,7 @@
             s = Encoder().encode(self.kwargs)
             return '%s >>> %s' % (self.message, s)
 
-    _ = StructuredMessage
+    _ = StructuredMessage   # optional, to improve readability
 
     def main():
         logging.basicConfig(level=logging.INFO, format='%(message)s')
@@ -1688,3 +1692,6 @@
 
     message 1 >>> {"snowman": "\u2603", "set_value": [1, 2, 3]}
 
+Note that the order of items might be different according to the version of
+Python used.
+

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list