From bb5f5180417d92605a93bc55ddcc874f2707663a Mon Sep 17 00:00:00 2001 From: Ruben van de Ven Date: Sat, 27 Apr 2019 16:39:20 +0200 Subject: [PATCH] Timeline stuff --- README.md | 1 + hugvey/panopticon.py | 2 +- www/js/hugvey_timeline.js | 8 ++++++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 96f2a3b..be3119b 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,7 @@ copy autossh-hugvey.service to `/etc/systemd/system/`: ```bash cp autossh-hugvey.service /etc/systemd/system/autossh-hugvey.service +sudo systemctl enable autossh-hugvey.service ``` ### clients diff --git a/hugvey/panopticon.py b/hugvey/panopticon.py index 15942c7..0ebf21c 100644 --- a/hugvey/panopticon.py +++ b/hugvey/panopticon.py @@ -263,7 +263,7 @@ class Panopticon(object): assert isinstance(record, logging.LogRecord) hugvey_id = record.name.split('.')[1] items = record.msg.split(':', 2) - msg = {'action': 'log', 'id':hugvey_id, 'type': items[0]} + msg = {'action': 'log', 'id':hugvey_id, 'type': items[0], 'lvl':record.levelno, 'lvlname':record.levelname} if len(items) > 1: msg['info'] = items[1] if len(items) > 2: diff --git a/www/js/hugvey_timeline.js b/www/js/hugvey_timeline.js index 7723145..560ba49 100644 --- a/www/js/hugvey_timeline.js +++ b/www/js/hugvey_timeline.js @@ -129,7 +129,9 @@ class Timeline{ break; case 'story': // 'info': 'start'/'finished' - this.eventDataSet.add({content: msg['type'] +': ' + msg['info'] + ': ' + msg['args'], start: new Date(), type: 'point', group: hv_id, 'className': 'story'}); + this.eventDataSet.add({ + content: msg['type'] +': ' + msg['info'] + (msg.hasOwnProperty('args')? ': '+msg['args'] : ""), + start: new Date(), type: 'point', group: hv_id, 'className': 'story'}); break; case 'condition': @@ -137,7 +139,9 @@ class Timeline{ // don't draw these :-0 break; default: - this.eventDataSet.add({content: msg['type'] +': ' + msg['info'] + ': ' + msg['args'], start: new Date(), type: 'point', group: hv_id}); + this.eventDataSet.add({ + content: msg['type'] +': ' + msg['info'] + (msg.hasOwnProperty('args')? ': '+msg['args'] : ""), + start: new Date(), type: 'point', group: hv_id, 'className': msg['lvlname']}); break; } }