From: <bov...@us...> - 2006-05-02 23:26:05
|
Revision: 1202 Author: boverhof Date: 2006-05-02 16:26:00 -0700 (Tue, 02 May 2006) ViewCVS: http://svn.sourceforge.net/pywebsvcs/?rev=1202&view=rev Log Message: ----------- M logging.py -- use debugOn w/i "debug" to test if should log event. Modified Paths: -------------- trunk/wstools/logging.py Modified: trunk/wstools/logging.py =================================================================== --- trunk/wstools/logging.py 2006-05-02 23:23:20 UTC (rev 1201) +++ trunk/wstools/logging.py 2006-05-02 23:26:00 UTC (rev 1202) @@ -31,20 +31,18 @@ debugOn = lambda self: self.level >= DEBUG warnOn = lambda self: self.level >= WARN -_LoggerClass = ILogger - class BasicLogger(ILogger): def __init__(self, msg, out=sys.stdout): self.msg, self.out = msg, out def warning(self, msg, *args): - if self.level < 1: return + if self.warnOn() is False: return print >>self, BasicLogger.WARN, self.msg, print >>self, msg %args WARN = 'WARN' def debug(self, msg, *args): - if self.level < 2: return + if self.debugOn() is False: return print >>self, BasicLogger.DEBUG, self.msg, print >>self, msg %args DEBUG = 'DEBUG' @@ -58,6 +56,7 @@ ''' for s in args: self.out.write(s) +_LoggerClass = BasicLogger def setBasicLogger(): '''Use Basic Logger. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |