fix: system_all_log.html ReferenceError and other updates
This commit is contained in:
@@ -53,11 +53,26 @@ $(window).resize(function() {
|
||||
});
|
||||
|
||||
|
||||
function escapeHtml(text) {
|
||||
var div = document.createElement('div');
|
||||
div.appendChild(document.createTextNode(text));
|
||||
return div.innerHTML;
|
||||
}
|
||||
|
||||
function formatLogLine(line) {
|
||||
var className = '';
|
||||
if (line.indexOf('ERROR') !== -1) className = 'text-danger';
|
||||
else if (line.indexOf('WARNING') !== -1) className = 'text-warning';
|
||||
else if (line.indexOf('INFO') !== -1) className = 'text-info';
|
||||
else if (line.indexOf('DEBUG') !== -1) className = 'text-muted';
|
||||
return '<div class="' + className + '" style="white-space: pre-wrap; font-family: monospace; font-size: 13px;">' + escapeHtml(line) + '</div>';
|
||||
}
|
||||
|
||||
socket.on('on_start', function(data){
|
||||
lines = splitLines(data.data);
|
||||
var lines = data.data.split('\n');
|
||||
var html = '';
|
||||
for (i in lines) {
|
||||
html += logline(lines[i]);
|
||||
for (var i in lines) {
|
||||
html += formatLogLine(lines[i]);
|
||||
}
|
||||
$('#log_div').html(html)
|
||||
document.getElementById("log_div").scrollTop = document.getElementById("log_div").scrollHeight;
|
||||
@@ -66,7 +81,7 @@ socket.on('on_start', function(data){
|
||||
|
||||
socket.on('add', function(data){
|
||||
if (data.filename == current_filename) {
|
||||
$('#log_div').append(logline(data.data.trim()));
|
||||
$('#log_div').append(formatLogLine(data.data.trim()));
|
||||
document.getElementById("log_div").scrollTop = document.getElementById("log_div").scrollHeight;
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user