Skip to content

Commit

Permalink
fix broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jstrachan committed Dec 16, 2013
1 parent 13250c5 commit a86592c
Showing 1 changed file with 24 additions and 16 deletions.
40 changes: 24 additions & 16 deletions hawtio-web/src/main/webapp/lib/loggingInit.js
Expand Up @@ -16,7 +16,9 @@ if ('localStorage' in window) {
// console.log("showLog: ", showLog);
if (showLog === 'true') {
var container = document.getElementById("log-panel");
container.setAttribute("style", "bottom: 50%;");
if (container) {
container.setAttribute("style", "bottom: 50%;");
}
}
}

Expand Down Expand Up @@ -51,10 +53,12 @@ if ('console' in window) {
hdlr = MyConsole.info;
}

try {
hdlr.apply(MyConsole, messages);
} catch (e) {
MyConsole.log(messages);
if (hdlr && hdlr.apply) {
try {
hdlr.apply(MyConsole, messages);
} catch (e) {
MyConsole.log(messages);
}
}
};
}
Expand Down Expand Up @@ -179,21 +183,25 @@ Logger.setHandler(function(messages, context) {
node.className = context.level.name;

var scroll = false;
if (container.scrollHeight = 0) {
scroll = true;
}
if (container) {
if (container.scrollHeight = 0) {
scroll = true;
}

if (panel.scrollTop > (panel.scrollHeight - container.scrollHeight - 200)) {
scroll = true;
if (panel.scrollTop > (panel.scrollHeight - container.scrollHeight - 200)) {
scroll = true;
}
}

function onAdd() {
panel.appendChild(node);
if (panel.childNodes.length > parseInt(window['LogBuffer'])) {
panel.firstChild.remove();
}
if (scroll) {
panel.scrollTop = panel.scrollHeight;
if (panel) {
panel.appendChild(node);
if (panel.childNodes.length > parseInt(window['LogBuffer'])) {
panel.firstChild.remove();
}
if (scroll) {
panel.scrollTop = panel.scrollHeight;
}
}
if (consoleLogger) {
consoleLogger(messages, context);
Expand Down

0 comments on commit a86592c

Please sign in to comment.