summaryrefslogtreecommitdiff
path: root/Lib/logging/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/logging/__init__.py')
-rw-r--r--Lib/logging/__init__.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
index 2125a5eda0..3b8512384d 100644
--- a/Lib/logging/__init__.py
+++ b/Lib/logging/__init__.py
@@ -41,8 +41,8 @@ except ImportError:
__author__ = "Vinay Sajip <vinay_sajip@red-dove.com>"
__status__ = "production"
-__version__ = "0.5.0.2"
-__date__ = "16 February 2007"
+__version__ = "0.5.0.3"
+__date__ = "26 September 2007"
#---------------------------------------------------------------------------
# Miscellaneous module data
@@ -236,7 +236,7 @@ class LogRecord:
# 'Value is %d' instead of 'Value is 0'.
# For the use case of passing a dictionary, this should not be a
# problem.
- if args and (len(args) == 1) and args[0] and isinstance(args[0], dict):
+ if args and len(args) == 1 and isinstance(args[0], dict) and args[0]:
args = args[0]
self.args = args
self.levelname = getLevelName(level)
@@ -730,7 +730,8 @@ class StreamHandler(Handler):
"""
Flushes the stream.
"""
- self.stream.flush()
+ if self.stream:
+ self.stream.flush()
def emit(self, record):
"""
@@ -780,9 +781,11 @@ class FileHandler(StreamHandler):
"""
Closes the stream.
"""
- self.flush()
- self.stream.close()
- StreamHandler.close(self)
+ if self.stream:
+ self.flush()
+ self.stream.close()
+ StreamHandler.close(self)
+ self.stream = None
def _open(self):
"""
@@ -1245,7 +1248,7 @@ def basicConfig(**kwargs):
hdlr.setFormatter(fmt)
root.addHandler(hdlr)
level = kwargs.get("level")
- if level:
+ if level is not None:
root.setLevel(level)
#---------------------------------------------------------------------------