Skip to content

Commit

Permalink
fixed logger message duplicate, added initial structure for message c…
Browse files Browse the repository at this point in the history
…ollapse in ws.js
  • Loading branch information
ocean1 committed Dec 3, 2015
1 parent ec57ae0 commit d50e44e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def format(self, record):
username=getpass.getuser(),
time=datetime.utcnow(),
host=gethostname(),
message=msg,
msg=msg,
args=tuple(unicode(arg) for arg in record.args)
)
if 'exc_info' in data and data['exc_info']:
Expand Down
18 changes: 12 additions & 6 deletions static/js/ws.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,24 @@ function add_log(msg){

level = levels[msg['levelname']];

// append data to the DOM item

row = $("#loglist tr:first()");
alert(row);
// check if we have the same message preceding this
row = $("#loglist tr:first()");
if (row.length){
old_msg = row.data()
// if the old msg contains the same msg
if (msg.msg == old_msg){
//increment the counter here
}
}

// append data to the DOM item
$("#loglist tr:first()").data(msg);

$("#loglist").prepend(
'<tr class="' + level + '"><td>'
+ msg['time'] +
"</td><td><span class=\"logmsg\">" + msg['message'] + "</span>" + '</td></tr>');
"</td><td><span class=\"logmsg\">" + msg['msg'] + "</span>" + '</td></tr>');

$("#loglist tr:first()").data(msg);
};

function set_footer(txt, color){
Expand Down

0 comments on commit d50e44e

Please sign in to comment.