Fixed log so source is better described.

This commit is contained in:
Adolfo Gómez 2013-01-10 16:37:44 +00:00
parent 59b4f27ca7
commit 462cfe9391
2 changed files with 5 additions and 5 deletions

View File

@ -39,7 +39,7 @@ useLogger = logging.getLogger('useLog')
OTHER,DEBUG,INFO,WARN,ERROR,FATAL = (10000*(x+1) for x in xrange(6)) OTHER,DEBUG,INFO,WARN,ERROR,FATAL = (10000*(x+1) for x in xrange(6))
# Logging sources # Logging sources
INTERNAL,ACTOR,TRANSPORT = ('internal', 'actor', 'transport') INTERNAL,ACTOR,TRANSPORT, OSMANAGER = ('internal', 'actor', 'transport', 'osmanager')
OTHERSTR,DEBUGSTR,INFOSTR,WARNSTR,ERRORSTR,FATALSTR = ('OTHER', 'DEBUG', 'INFO', 'WARN', 'ERROR', 'FATAL') OTHERSTR,DEBUGSTR,INFOSTR,WARNSTR,ERRORSTR,FATALSTR = ('OTHER', 'DEBUG', 'INFO', 'WARN', 'ERROR', 'FATAL')

View File

@ -86,13 +86,13 @@ class WindowsOsManager(osmanagers.OSManager):
si.setIp(val) si.setIp(val)
break break
def doLog(self, service, data): def doLog(self, service, data, origin = log.OSMANAGER):
# Stores a log associated with this service # Stores a log associated with this service
try: try:
msg, level = data.split('\t') msg, level = data.split('\t')
service.doLog(level, msg, log.ACTOR) service.doLog(level, msg, origin)
except: except:
service.doLog(log.ERROR, "do not understand {0}".format(data), log.ACTOR) service.doLog(log.ERROR, "do not understand {0}".format(data), log.TRANSPORT)
def process(self,service,msg, data): def process(self,service,msg, data):
@ -118,7 +118,7 @@ class WindowsOsManager(osmanagers.OSManager):
ret = self.infoValue(service) ret = self.infoValue(service)
state = State.PREPARING state = State.PREPARING
elif msg == "log": elif msg == "log":
self.doLog(service, data) self.doLog(service, data, log.ACTOR)
elif msg == "logon": elif msg == "logon":
si = service.getInstance() si = service.getInstance()
si.userLoggedIn(data) si.userLoggedIn(data)