# Licensed for distribution under the GPL version 2, check COPYING for details
from twisted.python import log
+
import sys, time
import config
def observer2(eventDict):
edm = eventDict['message']
if isinstance(edm, LogEvent):
- if edm.category == INFO and config.debugLevel < 3:
+ if edm.category == INFO and config._debugLevel < 3:
return
- if (edm.category == WARN or edm.category == ERROR) and config.debugLevel < 2:
+ if (edm.category == WARN or edm.category == ERROR) and config._debugLevel < 2:
return
text = str(edm)
elif edm:
- if config.debugLevel < 3: return
+ if config._debugLevel < 3: return
text = ' '.join(map(str, edm))
else:
if eventDict['isError'] and eventDict.has_key('failure'):
- if config.debugLevel < 1: return
+ if config._debugLevel < 1: return
text = eventDict['failure'].getTraceback()
elif eventDict.has_key('format'):
- if config.debugLevel < 3: return
+ if config._debugLevel < 3: return
text = eventDict['format'] % eventDict
else:
return
debugFile.close()
try:
- config.debugLevel = int(config.debugLevel)
+ config._debugLevel = int(config.debugLevel.strip())
except ValueError:
- config.debugLevel = 0
+ config._debugLevel = 0
+ config.debugLevel = "0"
- if config.debugLevel > 0:
+ if config._debugLevel > 0:
if len(config.debugFile) > 0:
try:
- debugFile = open(config.debugFile, "w")
- log.msg("Rewrote log file.")
+ debugFile = open(config.debugFile, "a")
+ log.msg("Reopened log file.")
except IOError:
log.discardLogs() # Give up
debugFile = sys.__stdout__