Skip to content

Commit

Permalink
bug fixes: logging,...
Browse files Browse the repository at this point in the history
  • Loading branch information
isra67 committed Oct 26, 2017
1 parent 79c1e28 commit 2df1a15
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
28 changes: 14 additions & 14 deletions public/views/logging.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,27 +53,27 @@ <h3>Logging</h3>
socket.on('messages', function(data) {
var FILL = 'span';
if (logActive > 0) {
var intclass = '', ix, i, j, a;
var intclass = '', ix, i, j, a, LAST_IDX = 10;
if (data.indexOf('[DEBUG ') > -1) intclass = ' cmsg_d';
else if (data.indexOf('[INFO ') > -1) intclass = ' cmsg_i';
else if (data.indexOf('[WARNING') > -1) intclass = ' cmsg_w';
else if (data.indexOf('[ERROR ') > -1) intclass = ' cmsg_e';

var regexp = /.\[DEBUG /gm;
regexp.lastIndex = 10;
data = data.replace(regexp, '<br/></'+FILL+'><'+FILL+' class="dbgmsgs cmsg_d">'+ ' [DEBUG ');
regexp = /.\[INFO /gm;
regexp.lastIndex = 10;
data = data.replace(regexp, '<br/></'+FILL+'><'+FILL+' class="dbgmsgs cmdg_i">'+ ' [INFO ');
regexp = /.\[WARNING /gm;
regexp.lastIndex = 10;
data = data.replace(regexp, '<br/></'+FILL+'><'+FILL+' class="dbgmsgs cmdg_w">'+ ' [WARNING ');
regexp = /.\[ERROR /gm;
regexp.lastIndex = 10;
data = data.replace(regexp, '<br/></'+FILL+'><'+FILL+' class="dbgmsgs cmdg_e">'+ ' [ERROR ');
var regexp = /\[DEBUG /gm;
regexp.lastIndex = LAST_IDX;
data = data.replace(regexp, '</'+FILL+'><'+FILL+' class="dbgmsgs cmsg_d"><br/>'+ ' [DEBUG ');
regexp = /\[INFO /gm;
regexp.lastIndex = LAST_IDX;
data = data.replace(regexp, '</'+FILL+'><'+FILL+' class="dbgmsgs cmdg_i"><br/>'+ ' [INFO ');
regexp = /\[WARNING /gm;
regexp.lastIndex = LAST_IDX;
data = data.replace(regexp, '</'+FILL+'><'+FILL+' class="dbgmsgs cmdg_w"><br/>'+ ' [WARNING ');
regexp = /\[ERROR /gm;
regexp.lastIndex = LAST_IDX;
data = data.replace(regexp, '</'+FILL+'><'+FILL+' class="dbgmsgs cmdg_e"><br/>'+ ' [ERROR ');

try {
$('<'+FILL+' class="dbgmsgs' + intclass + '">' + data + '<br/></'+FILL+'>').appendTo('#logcontent');
$('<'+FILL+' class="dbgmsgs' + intclass + '">' + data + '</'+FILL+'>').appendTo('#logcontent');
$('div#logcontent').animate({"scrollTop": $('div#logcontent')[0].scrollHeight}, 1);
}
catch(err) { }
Expand Down
6 changes: 3 additions & 3 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,17 @@ function iniStatStruct() {
var repo = (err) ? 'production' : d;
repo = (repo.indexOf('development') > 0) ? 'isra67' : 'inoteska';

console.log('d:', d, 'repo:', repo);
// console.log('d:', d, 'repo:', repo);

exec_process.result('/root/app/checkupdate.sh ' + repo,
function(err,data) {
console.log('app:',data);
// console.log('app:',data);
appStatusStruct.updates = data.indexOf('equal') > -1 ? '' : 'new';

if (appStatusStruct.updates == '') {
exec_process.result('/root/indoorpy/checkupdate.sh ' + repo,
function(err,datai) {
console.log('py:',datai);
// console.log('py:',datai);
appStatusStruct.updates = datai.indexOf('equal') > -1 ? '' : 'new';
});
}
Expand Down

0 comments on commit 2df1a15

Please sign in to comment.