summaryrefslogtreecommitdiffstats
path: root/Doc/whatsnew
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2004-07-07 13:01:53 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>2004-07-07 13:01:53 (GMT)
commitbcefe698b0f82aef010e1d6a0c88485ef607618b (patch)
tree9f5e5c9b3acdc7c30542dd48455289091d2ae720 /Doc/whatsnew
parent6fe93cdeb31c699babf0efee7957bea3c4b0e576 (diff)
downloadcpython-bcefe698b0f82aef010e1d6a0c88485ef607618b.zip
cpython-bcefe698b0f82aef010e1d6a0c88485ef607618b.tar.gz
cpython-bcefe698b0f82aef010e1d6a0c88485ef607618b.tar.bz2
Add logging changes
Diffstat (limited to 'Doc/whatsnew')
-rw-r--r--Doc/whatsnew/whatsnew24.tex25
1 files changed, 23 insertions, 2 deletions
diff --git a/Doc/whatsnew/whatsnew24.tex b/Doc/whatsnew/whatsnew24.tex
index ac80989..4d18a9b 100644
--- a/Doc/whatsnew/whatsnew24.tex
+++ b/Doc/whatsnew/whatsnew24.tex
@@ -782,12 +782,33 @@ If the separation is large, then you might as well use
another, \function{tee()} is ideal. Possible applications include
bookmarking, windowing, or lookahead iterators.
+\item A \function{basicConfig} function was added to the
+\module{logging} package to simplify log configuration. It defaults
+to logging to standard error, but a
+number of optional keyword arguments can be specified to
+log to a particular file, change the logging format, or set the
+logging level. For example:
+
+\begin{verbatim}
+import logging
+logging.basicConfig(filename = '/var/log/application.log',
+ level=0, # Log all messages, including debugging,
+ format='%(levelname):%(process):%(thread):%(message)')
+\end{verbatim}
+
+Another addition to \module{logging} is a
+\class{TimedRotatingFileHandler} class which rotates its log files at
+a timed interval. The module already had \class{RotatingFileHandler},
+which rotated logs once the file exceeded a certain size. Both
+classes derive from a new \class{BaseRotatingHandler} class that can
+be used to implement other rotating handlers.
+
\item The \module{operator} module gained two new functions,
\function{attrgetter(\var{attr})} and \function{itemgetter(\var{index})}.
Both functions return callables that take a single argument and return
the corresponding attribute or item; these callables make excellent
-data extractors when used with \function{map()} or \function{sorted()}.
-For example:
+data extractors when used with \function{map()} or
+\function{sorted()}. For example:
\begin{verbatim}
>>> L = [('c', 2), ('d', 1), ('a', 4), ('b', 3)]