Added possibility to show or not in dashboard text that is logged

pull/108/head
Mokaddem 2017-02-28 10:21:27 +01:00
parent 85a6f6fa63
commit ccdf256383
1 changed files with 5 additions and 5 deletions

View File

@ -627,8 +627,7 @@ def fetchQueueData():
if int(card) > 0: if int(card) > 0:
# Queue need to be killed # Queue need to be killed
if int((datetime.datetime.now() - startTime_readable).total_seconds()) > args.treshold: if int((datetime.datetime.now() - startTime_readable).total_seconds()) > args.treshold:
log(([str(time.time()), queue, "-", "ST:"+str(timestamp)+" PT:"+str(time.time()-float(timestamp))], 0), True) log(([str(time.time()), queue, "-", "ST:"+str(timestamp)+" PT:"+str(time.time()-float(timestamp))], 0), True, show_in_board=False)
#log.write(json.dumps([queue, card, str(startTime_readable), str(processed_time_readable), path]) + "\n")
try: try:
last_kill_try = time.time() - lastTimeKillCommand[moduleNum] last_kill_try = time.time() - lastTimeKillCommand[moduleNum]
except KeyError: except KeyError:
@ -718,9 +717,10 @@ def format_string(tab, padding_row):
printstring.append( (text, the_pid) ) printstring.append( (text, the_pid) )
return printstring return printstring
def log(data, write_on_disk=False): def log(data, write_on_disk=False, show_in_board=True):
printarrayLog.insert(0, data) if show_in_board:
printarrayLog.pop() printarrayLog.insert(0, data)
printarrayLog.pop()
if write_on_disk: if write_on_disk:
with open(log_filename, 'a') as log: with open(log_filename, 'a') as log:
log.write(json.dumps(data[0]) + "\n") log.write(json.dumps(data[0]) + "\n")