-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmonitor.html
112 lines (98 loc) · 3.96 KB
/
monitor.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<html>
<head>
<title>Application Log Monitor</title>
<style type="text/css">
pre.appmonitor { padding:0px; margin:0px; white-space:pre; font-family:monospace; }
pre.ERROR { color:#990000; }
pre.WARN { color:#996600; }
pre.INFO { color:#000000; }
pre.DEBUG { color:#444444; }
pre.TRACE { color:#888888; }
</style>
<script type="text/javascript" language="JavaScript">
var parentOpen = true
window.initMonitor = function() {
if (window._name)
window.setName(window._name);
};
window.onunload = UpdateParent;
function UpdateParent(){
//Only if the parent is open, update the status of the child window
if (parentOpen)
{
window.opener.childOpen = false;
}
}
window.setName = function(strName) {
window.document.title = strName + " Application Monitor";
window.document.getElementById("title").innerHTML = strName + " Application Monitor";
};
window.isFirstTime = function() {
return typeof(this._hasappendedmsg) == "undefined";
};
window.appendMessage = function(strMessage,strClass) {
var logLevel=strMessage.split('|')[0];
//var methods = [ "error", "warn", "info", "debug", "log"];
var strClass="";
switch (logLevel)
{
case 'error ':
strClass='ERROR';
break;
case 'warn ':
strClass='WARN';
break;
case 'info ':
strClass='INFO';
break;
case 'debug ':
strClass='DEBUG';
break;
case 'log ':
strClass='TRACE';
break;
}
this._hasappendedmsg = true;
//append the new message to the 'content' block
var content = window.document.getElementById("content");
var scrollPane = content.parentNode;
if (content.insertAdjacentHTML) {
strMessage = String(strMessage).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""");
content.insertAdjacentHTML("beforeEnd",
'<pre class="appmonitor ' + strClass+ '">' + strMessage + '</pre>');
} else {
var oElm = document.createElement("pre");
oElm.className = "appmonitor" + (strClass ? (" " + strClass) : "");
var tokens = strMessage.split(/\n/g);
for (var i = 0; i < tokens.length; i++) {
if (i > 0)
oElm.appendChild(document.createElement("br"));
oElm.appendChild(document.createTextNode(tokens[i]));
}
content.appendChild(oElm);
}
// scroll to last message
// Doing this in a timeout helps performance significantly.
if (!window._scrollTOID &&
(scrollPane.scrollTop >= content.lastChild.offsetTop - scrollPane.offsetHeight - 2 * content.lastChild.offsetHeight)) {
window._scrollTOID = window.setTimeout(function() {
window._scrollTOID = null;
if (content.firstChild)
scrollPane.scrollTop = content.lastChild.offsetTop;
}, 200);
}
};
</script>
</head>
<body onload="initMonitor();" RIGHTMARGIN="0" BOTTOMMARGIN="0" LEFTMARGIN="0" TOPMARGIN="0">
<div id="title" style='position:relative;float:left;font-size:10px;height:17px;width:100%;
color:#000000;background-color:#ffffff;overflow:hidden;font-family:Verdana, sans-serif;z-index:2;
font-weight:bold;text-align:left;padding-top: 1px; padding-left: 4px;border-bottom:dashed 1px #a8a8b5;'>Application Log Monitor</div>
<div style='clear:left;position:absolute;font-size:11px;left:0px;top:0px;width:100%;height:100%;
color:#000000;overflow:auto;font-family:Monaco, Courier, monospace;z-index:1;'>
<div id="content" style='position:relative;font-size:11px;color:#000000;
text-align:left;padding: 19px 4px 2px 4px;'>
</div>
</div>
</body>
</html>