mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
Merged revisions 66141,66145,66150,66180,66211,66217,66219,66226,66231,66244,66246,66249-66250,66264,66268,66272,66294,66306 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r66141 | gregory.p.smith | 2008-09-02 00:29:51 -0500 (Tue, 02 Sep 2008) | 3 lines Issue #3678: Correctly pass LDFLAGS and LDLAST to the linker on shared library targets in the Makefile. ........ r66145 | marc-andre.lemburg | 2008-09-02 05:32:34 -0500 (Tue, 02 Sep 2008) | 5 lines Add quotes around the file name to avoid issues with spaces. Closes #3719. ........ r66150 | marc-andre.lemburg | 2008-09-02 07:11:19 -0500 (Tue, 02 Sep 2008) | 3 lines Add news item for #3719. ........ r66180 | vinay.sajip | 2008-09-03 04:20:05 -0500 (Wed, 03 Sep 2008) | 1 line Issue #3726: Allowed spaces in separators in logging configuration files. ........ r66211 | vinay.sajip | 2008-09-04 02:31:21 -0500 (Thu, 04 Sep 2008) | 1 line Issue #3772: Fixed regression problem in StreamHandler.emit(). ........ r66217 | andrew.kuchling | 2008-09-04 08:26:24 -0500 (Thu, 04 Sep 2008) | 1 line #3671: various corrections and markup fixes noted by Kent Johnson ........ r66219 | hirokazu.yamamoto | 2008-09-04 09:25:30 -0500 (Thu, 04 Sep 2008) | 1 line Added NEWS ........ r66226 | benjamin.peterson | 2008-09-04 18:31:27 -0500 (Thu, 04 Sep 2008) | 1 line flesh out the documentation on using 2to3 ........ r66231 | andrew.kuchling | 2008-09-05 10:15:56 -0500 (Fri, 05 Sep 2008) | 1 line #3671: Typo fix ........ r66244 | jesse.noller | 2008-09-05 20:20:11 -0500 (Fri, 05 Sep 2008) | 2 lines Fix typo in multiprocessing doc, cancel_join_thread was missing _thread ........ r66246 | benjamin.peterson | 2008-09-05 22:00:00 -0500 (Fri, 05 Sep 2008) | 1 line actually tell the name of the flag to use ........ r66249 | andrew.kuchling | 2008-09-06 07:50:05 -0500 (Sat, 06 Sep 2008) | 1 line Various corrections ........ r66250 | andrew.kuchling | 2008-09-06 08:04:02 -0500 (Sat, 06 Sep 2008) | 1 line #3040: include 'dest' argument in example; trim some trailing whitespace ........ r66264 | benjamin.peterson | 2008-09-06 14:42:39 -0500 (Sat, 06 Sep 2008) | 1 line docs are pretty good about new-style classes these days ........ r66268 | andrew.kuchling | 2008-09-06 15:28:01 -0500 (Sat, 06 Sep 2008) | 1 line #3669 from Robert Lehmann: simplify use of iterator in example ........ r66272 | andrew.kuchling | 2008-09-06 16:26:02 -0500 (Sat, 06 Sep 2008) | 1 line #1317: describe the does_esmtp, ehlo_resp, esmtp_features, and helo_resp attributes ........ r66294 | georg.brandl | 2008-09-07 12:00:17 -0500 (Sun, 07 Sep 2008) | 2 lines Add a new howto about Python and the web, by Marek Kubica. ........ r66306 | mark.summerfield | 2008-09-08 09:45:37 -0500 (Mon, 08 Sep 2008) | 3 lines Added xrefs to each other. ........
This commit is contained in:
parent
e5b4ca6c99
commit
ae5360b31e
13 changed files with 888 additions and 76 deletions
|
@ -753,7 +753,7 @@ class StreamHandler(Handler):
|
|||
self.stream.write(fs % msg)
|
||||
else:
|
||||
try:
|
||||
if hasattr(self.stream, 'encoding'):
|
||||
if getattr(self.stream, 'encoding', None) is not None:
|
||||
self.stream.write(fs % msg.encode(self.stream.encoding))
|
||||
else:
|
||||
self.stream.write(fs % msg)
|
||||
|
|
|
@ -19,7 +19,7 @@ Configuration functions for the logging package for Python. The core package
|
|||
is based on PEP 282 and comments thereto in comp.lang.python, and influenced
|
||||
by Apache's log4j system.
|
||||
|
||||
Copyright (C) 2001-2007 Vinay Sajip. All Rights Reserved.
|
||||
Copyright (C) 2001-2008 Vinay Sajip. All Rights Reserved.
|
||||
|
||||
To use, simply 'import logging' and log away!
|
||||
"""
|
||||
|
@ -98,6 +98,8 @@ def _resolve(name):
|
|||
found = getattr(found, n)
|
||||
return found
|
||||
|
||||
def _strip_spaces(alist):
|
||||
return map(lambda x: x.strip(), alist)
|
||||
|
||||
def _create_formatters(cp):
|
||||
"""Create and return formatters"""
|
||||
|
@ -105,9 +107,10 @@ def _create_formatters(cp):
|
|||
if not len(flist):
|
||||
return {}
|
||||
flist = flist.split(",")
|
||||
flist = _strip_spaces(flist)
|
||||
formatters = {}
|
||||
for form in flist:
|
||||
sectname = "formatter_%s" % form.strip()
|
||||
sectname = "formatter_%s" % form
|
||||
opts = cp.options(sectname)
|
||||
if "format" in opts:
|
||||
fs = cp.get(sectname, "format", 1)
|
||||
|
@ -133,10 +136,11 @@ def _install_handlers(cp, formatters):
|
|||
if not len(hlist):
|
||||
return {}
|
||||
hlist = hlist.split(",")
|
||||
hlist = _strip_spaces(hlist)
|
||||
handlers = {}
|
||||
fixups = [] #for inter-handler references
|
||||
for hand in hlist:
|
||||
sectname = "handler_%s" % hand.strip()
|
||||
sectname = "handler_%s" % hand
|
||||
klass = cp.get(sectname, "class")
|
||||
opts = cp.options(sectname)
|
||||
if "formatter" in opts:
|
||||
|
@ -189,8 +193,9 @@ def _install_loggers(cp, handlers, disable_existing_loggers):
|
|||
hlist = cp.get(sectname, "handlers")
|
||||
if len(hlist):
|
||||
hlist = hlist.split(",")
|
||||
hlist = _strip_spaces(hlist)
|
||||
for hand in hlist:
|
||||
log.addHandler(handlers[hand.strip()])
|
||||
log.addHandler(handlers[hand])
|
||||
|
||||
#and now the others...
|
||||
#we don't want to lose the existing loggers,
|
||||
|
@ -240,8 +245,9 @@ def _install_loggers(cp, handlers, disable_existing_loggers):
|
|||
hlist = cp.get(sectname, "handlers")
|
||||
if len(hlist):
|
||||
hlist = hlist.split(",")
|
||||
hlist = _strip_spaces(hlist)
|
||||
for hand in hlist:
|
||||
logger.addHandler(handlers[hand.strip()])
|
||||
logger.addHandler(handlers[hand])
|
||||
|
||||
#Disable any old loggers. There's no point deleting
|
||||
#them as other threads may continue to hold references
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue