Commit 65c8a51d authored by Martijn Pieters's avatar Martijn Pieters

Clean up indentation and trailing whitespace.

parent 07f45175
...@@ -2,16 +2,16 @@ ...@@ -2,16 +2,16 @@
# #
# Copyright (c) 2001, 2002 Zope Corporation and Contributors. # Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved. # All Rights Reserved.
# #
# This software is subject to the provisions of the Zope Public License, # This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution. # Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE # FOR A PARTICULAR PURPOSE
# #
############################################################################## ##############################################################################
__version__='$Revision: 1.6 $'[11:-2] __version__='$Revision: 1.7 $'[11:-2]
try: try:
# Use the exception formatter in zExceptions # Use the exception formatter in zExceptions
......
...@@ -2,16 +2,16 @@ ...@@ -2,16 +2,16 @@
# #
# Copyright (c) 2001, 2002 Zope Corporation and Contributors. # Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved. # All Rights Reserved.
# #
# This software is subject to the provisions of the Zope Public License, # This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution. # Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE # FOR A PARTICULAR PURPOSE
# #
############################################################################## ##############################################################################
__version__='$Revision: 1.11 $'[11:-2] __version__='$Revision: 1.12 $'[11:-2]
import os, sys, time import os, sys, time
...@@ -21,10 +21,10 @@ def severity_string(severity, mapping={ ...@@ -21,10 +21,10 @@ def severity_string(severity, mapping={
-300: 'TRACE', -300: 'TRACE',
-200: 'DEBUG', -200: 'DEBUG',
-100: 'BLATHER', -100: 'BLATHER',
0: 'INFO', 0: 'INFO',
100: 'PROBLEM', 100: 'PROBLEM',
200: 'ERROR', 200: 'ERROR',
300: 'PANIC', 300: 'PANIC',
}): }):
"""Convert a severity code to a string.""" """Convert a severity code to a string."""
s = mapping.get(int(severity), '') s = mapping.get(int(severity), '')
...@@ -71,7 +71,7 @@ class stupid_log_write: ...@@ -71,7 +71,7 @@ class stupid_log_write:
_log_level = int(severity) _log_level = int(severity)
else: else:
_log_level = 0 # INFO _log_level = 0 # INFO
def log(self, subsystem, severity, summary, detail, error): def log(self, subsystem, severity, summary, detail, error):
if _log_dest is None or severity < _log_level: if _log_dest is None or severity < _log_level:
return return
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
# #
# Copyright (c) 2001, 2002 Zope Corporation and Contributors. # Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved. # All Rights Reserved.
# #
# This software is subject to the provisions of the Zope Public License, # This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution. # Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE # FOR A PARTICULAR PURPOSE
# #
############################################################################## ##############################################################################
"""General logging facility """General logging facility
...@@ -70,7 +70,7 @@ with a callable object that takes 5 arguments: ...@@ -70,7 +70,7 @@ with a callable object that takes 5 arguments:
The callable object can provide a reinitialize method that may be The callable object can provide a reinitialize method that may be
called with no arguments to reopen the log files (if any) as part of a called with no arguments to reopen the log files (if any) as part of a
log-rotation facility. log-rotation facility.
There is a default event logging facility that: There is a default event logging facility that:
...@@ -86,7 +86,7 @@ There is a default event logging facility that: ...@@ -86,7 +86,7 @@ There is a default event logging facility that:
can be overridden with the environment variable EVENT_LOG_SEVERITY can be overridden with the environment variable EVENT_LOG_SEVERITY
""" """
__version__='$Revision: 1.7 $'[11:-2] __version__='$Revision: 1.8 $'[11:-2]
from MinimalLogger import log_write, log_time, severity_string, \ from MinimalLogger import log_write, log_time, severity_string, \
_set_log_dest, initialize _set_log_dest, initialize
...@@ -96,10 +96,10 @@ from FormatException import format_exception ...@@ -96,10 +96,10 @@ from FormatException import format_exception
TRACE = -300 TRACE = -300
DEBUG = -200 DEBUG = -200
BLATHER = -100 BLATHER = -100
INFO = 0 INFO = 0
PROBLEM = 100 PROBLEM = 100
WARNING = 100 WARNING = 100
ERROR = 200 ERROR = 200
PANIC = 300 PANIC = 300
def LOG(subsystem, severity, summary, detail='', error=None, reraise=None): def LOG(subsystem, severity, summary, detail='', error=None, reraise=None):
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
# #
# Copyright (c) 2001, 2002 Zope Corporation and Contributors. # Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved. # All Rights Reserved.
# #
# This software is subject to the provisions of the Zope Public License, # This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution. # Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE # FOR A PARTICULAR PURPOSE
# #
############################################################################## ##############################################################################
import os import os
...@@ -22,9 +22,9 @@ severity_string = { ...@@ -22,9 +22,9 @@ severity_string = {
-300: 'TRACE', -300: 'TRACE',
-200: 'DEBUG', -200: 'DEBUG',
-100: 'BLATHER', -100: 'BLATHER',
0: 'INFO', 0: 'INFO',
100: 'PROBLEM', 100: 'PROBLEM',
200: 'ERROR', 200: 'ERROR',
300: 'PANIC', 300: 'PANIC',
} }
...@@ -52,7 +52,7 @@ class StupidLogTest(unittest.TestCase): ...@@ -52,7 +52,7 @@ class StupidLogTest(unittest.TestCase):
del os.environ['STUPID_LOG_SEVERITY'] del os.environ['STUPID_LOG_SEVERITY']
if os.environ.has_key('EVENT_LOG_SEVERITY'): if os.environ.has_key('EVENT_LOG_SEVERITY'):
del os.environ['EVENT_LOG_SEVERITY'] del os.environ['EVENT_LOG_SEVERITY']
def setLog(self, severity=0): def setLog(self, severity=0):
os.environ['%s_LOG_FILE' % self.prefix] = self.path os.environ['%s_LOG_FILE' % self.prefix] = self.path
if severity: if severity:
...@@ -68,7 +68,7 @@ class StupidLogTest(unittest.TestCase): ...@@ -68,7 +68,7 @@ class StupidLogTest(unittest.TestCase):
if not line: if not line:
self.fail("can't find entry in log file") self.fail("can't find entry in log file")
line = f.readline() line = f.readline()
line = f.readline().strip() line = f.readline().strip()
_time, rest = line.split(" ", 1) _time, rest = line.split(" ", 1)
if time is not None: if time is not None:
...@@ -122,7 +122,7 @@ class StupidLogTest(unittest.TestCase): ...@@ -122,7 +122,7 @@ class StupidLogTest(unittest.TestCase):
1 / 0 1 / 0
except ZeroDivisionError, err: except ZeroDivisionError, err:
err = sys.exc_info() err = sys.exc_info()
zLOG.LOG("basic", zLOG.INFO, "summary") zLOG.LOG("basic", zLOG.INFO, "summary")
zLOG.LOG("basic", zLOG.ERROR, "raised exception", error=err) zLOG.LOG("basic", zLOG.ERROR, "raised exception", error=err)
...@@ -139,7 +139,7 @@ def test_suite(): ...@@ -139,7 +139,7 @@ def test_suite():
suite = unittest.makeSuite(StupidLogTest, 'check') suite = unittest.makeSuite(StupidLogTest, 'check')
suite.addTest(unittest.makeSuite(EventLogTest, 'check')) suite.addTest(unittest.makeSuite(EventLogTest, 'check'))
return suite return suite
if __name__ == "__main__": if __name__ == "__main__":
loader = unittest.TestLoader() loader = unittest.TestLoader()
loader.testMethodPrefix = "check" loader.testMethodPrefix = "check"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment