simplified logging. creates logging stuff in linspector now. no Logger class needed anymore. more advanced output in log message like filename,funcname,linenumber
This commit is contained in:
parent
3d63f48621
commit
4048bc252e
4 changed files with 51 additions and 22 deletions
|
|
@ -27,12 +27,12 @@ class Command:
|
|||
|
||||
try:
|
||||
self.commandStart = dt.now()
|
||||
self.log.i("calling command " + str(self.command) + " at " + str(self.commandStart))
|
||||
self.log.info("calling command " + str(self.command) + " at " + str(self.commandStart))
|
||||
#self.output=sp.check_output(self.command.split())
|
||||
process = Popen(self.command, stdout=sp.PIPE, stderr=sp.PIPE, shell=True)
|
||||
self.output, self.error = process.communicate()
|
||||
self.log.d(str(self.output))
|
||||
self.log.d(str(self.error))
|
||||
self.log.debug(str(self.output))
|
||||
self.log.debug(str(self.error))
|
||||
self.retcode = process.poll()
|
||||
except CalledProcessError:
|
||||
self.error = CalledProcessError.output
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class Job:
|
|||
self.jobThreshold += 1
|
||||
|
||||
if self.jobThreshold >= serviceThreshold:
|
||||
self.log.d("Threshold reached!")
|
||||
self.log.debug("Threshold reached!")
|
||||
self.handle_alarm(jobInfo, self.jobThreshold - serviceThreshold)
|
||||
|
||||
def handle_alarm(self, jobInfo, thresholdOffset):
|
||||
|
|
@ -49,8 +49,8 @@ class Job:
|
|||
task.execute(jobInfo.get_message(), self.core)
|
||||
|
||||
def handle_call(self):
|
||||
self.log.d("handle call")
|
||||
self.log.d(self.service)
|
||||
self.log.debug("handle call")
|
||||
self.log.debug(self.service)
|
||||
try:
|
||||
jobInfo = JobInfo(self.host, self.service)
|
||||
self.service._execute(jobInfo)
|
||||
|
|
@ -58,12 +58,12 @@ class Job:
|
|||
|
||||
self.handle_threshold(jobInfo, self.service.get_threshold(), jobInfo.was_execution_successful())
|
||||
|
||||
self.log.d("Code: " + str(jobInfo.get_errorcode()) + ", Message: " + str(jobInfo.get_message()))
|
||||
self.log.debug("Code: " + str(jobInfo.get_errorcode()) + ", Message: " + str(jobInfo.get_message()))
|
||||
|
||||
self.jobInfos.append(jobInfo)
|
||||
|
||||
except Exception, e:
|
||||
self.log.d(e)
|
||||
self.log.debug(e)
|
||||
|
||||
|
||||
class JobInfo(object):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue