From: <bov...@us...> - 2006-05-03 00:13:59
|
Revision: 1204 Author: boverhof Date: 2006-05-02 17:13:47 -0700 (Tue, 02 May 2006) ViewCVS: http://svn.sourceforge.net/pywebsvcs/?rev=1204&view=rev Log Message: ----------- M logging.py -- make log records more readable. Modified Paths: -------------- trunk/wstools/logging.py Modified: trunk/wstools/logging.py =================================================================== --- trunk/wstools/logging.py 2006-05-03 00:13:20 UTC (rev 1203) +++ trunk/wstools/logging.py 2006-05-03 00:13:47 UTC (rev 1204) @@ -33,23 +33,34 @@ class BasicLogger(ILogger): + last = '' + def __init__(self, msg, out=sys.stdout): self.msg, self.out = msg, out def warning(self, msg, *args): if self.warnOn() is False: return - print >>self, BasicLogger.WARN, self.msg, + if BasicLogger.last != self.msg: + BasicLogger.last = self.msg + print >>self, "---- ", self.msg, " ----" + print >>self, " %s " %BasicLogger.WARN, print >>self, msg %args - WARN = 'WARN' + WARN = '[WARN]' def debug(self, msg, *args): if self.debugOn() is False: return - print >>self, BasicLogger.DEBUG, self.msg, + if BasicLogger.last != self.msg: + BasicLogger.last = self.msg + print >>self, "---- ", self.msg, " ----" + print >>self, " %s " %BasicLogger.DEBUG, print >>self, msg %args - DEBUG = 'DEBUG' + DEBUG = '[DEBUG]' def error(self, msg, *args): - print >>self, BasicLogger.ERROR, self.msg, + if BasicLogger.last != self.msg: + BasicLogger.last = self.msg + print >>self, "---- ", self.msg, " ----" + print >>self, " %s " %BasicLogger.ERROR, print >>self, msg %args - ERROR = 'ERROR' + ERROR = '[ERROR]' def write(self, *args): '''Write convenience function; writes strings. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |