Added in support for new HPC Dashboard View, ability to retrieve HPC Dashboard view...
[plstackapi.git] / planetstack / core / static / log4javascript-1.4.6 / docs / lite.html
1 <?xml version="1.0"?>\r
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
3 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en" >\r
4         <head>\r
5                 <title>log4javascript 1.4 Lite</title>\r
6                 <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />\r
7                 <meta name="author" content="Tim Down - tim@log4javascript.org" />\r
8                 <meta name="description" content="log4javascript, a logging framework for JavaScript based on log4j" />\r
9                 <meta name="robots" content="all" />\r
10                 <link rel="stylesheet" type="text/css" media="screen,print" href="../main.css" title="Default" />\r
11                 <style type="text/css">\r
12                         .visibleifabletocopy {\r
13                                 display: none;\r
14                         }\r
15                         \r
16                         body.abletocopy .visibleifabletocopy {\r
17                                 display: block;\r
18                         }\r
19                 </style>\r
20                 <script type="text/javascript">\r
21                         function copyCode() {\r
22                                 if (window.clipboardData && clipboardData.setData) {\r
23                                         clipboardData.setData("Text", code);\r
24                                         alert("Code copied to clipboard.")\r
25                                 }\r
26                         }\r
27                         \r
28                         var code;\r
29                         \r
30                         window.onload = function() {\r
31                                 var textArea = document.getElementById("codetextarea");\r
32                                 code = textArea.value;\r
33                                 textArea.select(); \r
34                                 if (window.clipboardData && clipboardData.setData) {\r
35                                         document.body.className = "abletocopy";\r
36                                 }\r
37                         };\r
38                 </script>\r
39                 <link rel="stylesheet" type="text/css" media="screen,print" href="lite.css" title="Default" />\r
40         </head>\r
41         <body>\r
42                 <div id="container" class="nonav">\r
43                         <div id="header">\r
44                                 <h1><a href="../index.html">log4javascript</a></h1>\r
45                         </div>\r
46                         <div id="content">\r
47                                 <div id="nav">\r
48                                         <a class="navitem" href="../index.html">home</a>\r
49                                         | <a class="navitem" href="http://sourceforge.net/projects/log4javascript" target="_blank" title="Download (opens in new window)">download</a>\r
50                                         | <a class="navitem" href="index.html">docs</a>\r
51                                         | <a class="navitem" href="quickstart.html">quick start</a>\r
52                                         | <a class="navitem" href="../demos/index.html">demos</a>\r
53                                         | <a class="navitem" href="http://log4javascript.org" target="_blank">website</a>\r
54                                         | <a class="navitem" href="http://www.timdown.co.uk" target="_blank">timdown.co.uk</a>\r
55                                 </div>\r
56                                 <h1>log4javascript 1.4 Lite</h1>\r
57                                 <h2>Contents</h2>\r
58                                 <ul>\r
59                                         <li><a href="#intro">Introduction</a></li>\r
60                                         <li><a href="#code">Code</a></li>\r
61                                         <li><a href="#api">API</a></li>\r
62                                 </ul>\r
63                                 <div id="intro">\r
64                                         <h2>Introduction</h2>\r
65                                         <p>\r
66                                                 log4javascript Lite is designed to be a basic, lightweight, cross-browser logging tool. It\r
67                                                 provides functions to log messages of different severity to a pop-up window using the exactly\r
68                                                 the same syntax as log4javascript.\r
69                                         </p>\r
70                                         <p class="linktotop">\r
71                                                 <a href="#container">Top</a>\r
72                                         </p>\r
73                                 </div>\r
74                                 <div id="code">\r
75                                         <h2>Code</h2>\r
76                                         <p>\r
77                                                 You can copy the code for log4javascript Lite below:\r
78                                         </p>\r
79                                         <textarea id="codetextarea" cols="80" rows="10">\r
80 if(!Array.prototype.shift){Array.prototype.shift=function(){if(this.length>0){var firstItem=this[0];for(var i=0,len=this.length-1;i<len;i++){this[i]=this[i+1];}\r
81 this.length--;return firstItem;}};}\r
82 var log4javascript;(function(){var newLine="\r\n";function Log4JavaScript(){}\r
83 log4javascript=new Log4JavaScript();log4javascript.version="1.4.6";log4javascript.edition="log4javascript_lite";function getExceptionMessage(ex){if(ex.message){return ex.message;}else if(ex.description){return ex.description;}else{return String(ex);}}\r
84 function getUrlFileName(url){var lastSlashIndex=Math.max(url.lastIndexOf("/"),url.lastIndexOf("\\"));return url.substr(lastSlashIndex+1);}\r
85 function getExceptionStringRep(ex){if(ex){var exStr="Exception: "+getExceptionMessage(ex);try{if(ex.lineNumber){exStr+=" on line number "+ex.lineNumber;}\r
86 if(ex.fileName){exStr+=" in file "+getUrlFileName(ex.fileName);}}catch(localEx){}\r
87 if(showStackTraces&&ex.stack){exStr+=newLine+"Stack trace:"+newLine+ex.stack;}\r
88 return exStr;}\r
89 return null;}\r
90 function isError(err){return(err instanceof Error);}\r
91 function bool(obj){return Boolean(obj);}\r
92 var enabled=(typeof log4javascript_disabled!="undefined")&&log4javascript_disabled?false:true;log4javascript.setEnabled=function(enable){enabled=bool(enable);};log4javascript.isEnabled=function(){return enabled;};var showStackTraces=false;log4javascript.setShowStackTraces=function(show){showStackTraces=bool(show);};var Level=function(level,name){this.level=level;this.name=name;};Level.prototype={toString:function(){return this.name;},equals:function(level){return this.level==level.level;},isGreaterOrEqual:function(level){return this.level>=level.level;}};Level.ALL=new Level(Number.MIN_VALUE,"ALL");Level.TRACE=new Level(10000,"TRACE");Level.DEBUG=new Level(20000,"DEBUG");Level.INFO=new Level(30000,"INFO");Level.WARN=new Level(40000,"WARN");Level.ERROR=new Level(50000,"ERROR");Level.FATAL=new Level(60000,"FATAL");Level.OFF=new Level(Number.MAX_VALUE,"OFF");log4javascript.Level=Level;function Appender(){var getConsoleHtmlLines=function(){return['<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">','<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">','<head>','<title>log4javascript</title>','<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />','<!-- Make IE8 behave like IE7, having gone to all the trouble of making IE work -->','<meta http-equiv="X-UA-Compatible" content="IE=7" />','<script type="text/javascript">','//<![CDATA[','var loggingEnabled=true;var messagesBeforeDocLoaded=[];function toggleLoggingEnabled(){setLoggingEnabled($("enableLogging").checked);}','function setLoggingEnabled(enable){loggingEnabled=enable;}','function scrollToLatestEntry(){var l=getLogContainer();if(typeof l.scrollTop!="undefined"){var latestLogEntry=l.lastChild;if(latestLogEntry){l.scrollTop=l.scrollHeight;}}}','function log(logLevel,formattedMessage){if(loggingEnabled){if(loaded){doLog(logLevel,formattedMessage);}else{messagesBeforeDocLoaded.push([logLevel,formattedMessage]);}}}','function doLog(logLevel,formattedMessage){var logEntry=document.createElement("div");logEntry.appendChild(document.createTextNode(formattedMessage));logEntry.className="logentry "+logLevel.name;getLogContainer().appendChild(logEntry);scrollToLatestEntry();}','function mainPageReloaded(){var separator=document.createElement("div");separator.className="separator";separator.innerHTML="&nbsp;";getLogContainer().appendChild(separator);}','var loaded=false;var logLevels=["DEBUG","INFO","WARN","ERROR","FATAL"];window.onload=function(){setLogContainerHeight();toggleLoggingEnabled();for(var i=0;i<messagesBeforeDocLoaded.length;i++){doLog(messagesBeforeDocLoaded[i][0],messagesBeforeDocLoaded[i][1]);}','messagesBeforeDocLoaded=[];loaded=true;setTimeout(setLogContainerHeight,20);};function getLogContainer(){return $("log");}','function clearLog(){getLogContainer().innerHTML="";}','function $(id){return document.getElementById(id);}','function getWindowHeight(){if(window.innerHeight){return window.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){return document.documentElement.clientHeight;}else if(document.body){return document.body.clientHeight;}','return 0;}','function getChromeHeight(){return $("toolbar").offsetHeight;}','function setLogContainerHeight(){var windowHeight=getWindowHeight();$("body").style.height=getWindowHeight()+"px";getLogContainer().style.height=""+','Math.max(0,windowHeight-getChromeHeight())+"px";}','window.onresize=function(){setLogContainerHeight();};','//]]>','</scr' + 'ipt>','<style type="text/css">','body{background-color:white;color:black;padding:0;margin:0;font-family:tahoma,verdana,arial,helvetica,sans-serif;overflow:hidden}div#toolbar{border-top:solid #ffffff 1px;border-bottom:solid #aca899 1px;background-color:#f1efe7;padding:3px 5px;font-size:68.75%}div#toolbar input.button{padding:0 5px;font-size:100%}div#log{font-family:Courier New,Courier;font-size:75%;width:100%;overflow:auto;clear:both}*.logentry{overflow:visible;white-space:pre}*.TRACE{color:#666666}*.DEBUG{color:green}*.INFO{color:#000099}*.WARN{color:#999900}*.ERROR{color:red}*.FATAL{color:#660066}div#log div.separator{background-color:#cccccc;margin:5px 0;line-height:1px}','</style>','</head>','<body id="body">','<div id="toolbar">','Options:','<input type="checkbox" id="enableLogging" onclick="toggleLoggingEnabled()" class="stateful" checked="checked" title="Enable/disable logging" /><label for="enableLogging" id="enableLoggingLabel">Enable logging</label>','<input type="button" id="clearButton" value="Clear" onclick="clearLog()" class="stateful button" title="Clear all log messages"  />','<input type="button" id="closeButton" value="Close" onclick="window.close()" class="stateful button" title="Close the window" />','</div>','<div id="log" class="TRACE DEBUG INFO WARN ERROR FATAL"></div>','</body>','</html>'];};var popUp=null;var popUpsBlocked=false;var popUpClosed=false;var popUpLoaded=false;var complainAboutPopUpBlocking=true;var initialized=false;var isSupported=true;var width=600;var height=400;var focusPopUp=false;var queuedLoggingEvents=new Array();function isLoaded(win){try{return bool(win.loaded);}catch(ex){return false;}}\r
93 function finalInit(){popUpLoaded=true;appendQueuedLoggingEvents();}\r
94 function writeHtml(doc){var lines=getConsoleHtmlLines();doc.open();for(var i=0,len=lines.length;i<len;i++){doc.writeln(lines[i]);}\r
95 doc.close();}\r
96 function pollConsoleWindow(){function pollConsoleWindowLoaded(){if(popUpLoaded){clearInterval(poll);}else if(bool(popUp)&&isLoaded(popUp)){clearInterval(poll);finalInit();}}\r
97 var poll=setInterval(pollConsoleWindowLoaded,100);}\r
98 function init(){var windowProperties="width="+width+",height="+height+",status,resizable";var windowName="log4javascriptLitePopUp"+location.host.replace(/[^a-z0-9]/gi,"_");popUp=window.open("",windowName,windowProperties);popUpClosed=false;if(popUp){if(isLoaded(popUp)){popUp.mainPageReloaded();finalInit();}else{writeHtml(popUp.document);if(isLoaded(popUp)){finalInit();}else{pollConsoleWindow();}}}else{isSupported=false;if(complainAboutPopUpBlocking){alert("log4javascript: pop-up windows appear to be blocked. Please unblock them to use pop-up logging.");}}\r
99 initialized=true;}\r
100 function safeToAppend(){if(!popUpsBlocked&&!popUpClosed){if(popUp.closed){popUpClosed=true;return false;}\r
101 if(!popUpLoaded&&popUp.loaded){popUpLoaded=true;}}\r
102 return!popUpsBlocked&&popUpLoaded&&!popUpClosed;}\r
103 function padWithZeroes(num,len){var str=""+num;while(str.length<len){str="0"+str;}\r
104 return str;}\r
105 function padWithSpaces(str,len){while(str.length<len){str+=" ";}\r
106 return str;}\r
107 this.append=function(loggingEvent){if(!initialized){init();}\r
108 queuedLoggingEvents.push(loggingEvent);if(safeToAppend()){appendQueuedLoggingEvents();}};function appendQueuedLoggingEvents(){if(safeToAppend()){while(queuedLoggingEvents.length>0){var currentLoggingEvent=queuedLoggingEvents.shift();var date=currentLoggingEvent.timeStamp;var formattedDate=padWithZeroes(date.getHours(),2)+":"+\r
109 padWithZeroes(date.getMinutes(),2)+":"+padWithZeroes(date.getSeconds(),2);var formattedMessage=formattedDate+" "+padWithSpaces(currentLoggingEvent.level.name,5)+" - "+currentLoggingEvent.getCombinedMessages();var throwableStringRep=currentLoggingEvent.getThrowableStrRep();if(throwableStringRep){formattedMessage+=newLine+throwableStringRep;}\r
110 popUp.log(currentLoggingEvent.level,formattedMessage);}\r
111 if(focusPopUp){popUp.focus();}}}}\r
112 log4javascript.Appender=Appender;function Logger(){var appender=new Appender();var loggerLevel=Level.ALL;this.log=function(level,params){if(enabled&&level.isGreaterOrEqual(this.getLevel())){var exception;var finalParamIndex=params.length-1;var lastParam=params[params.length-1];if(params.length>1&&isError(lastParam)){exception=lastParam;finalParamIndex--;}\r
113 var messages=[];for(var i=0;i<=finalParamIndex;i++){messages[i]=params[i];}\r
114 var loggingEvent=new LoggingEvent(this,new Date(),level,messages,exception);appender.append(loggingEvent);}};this.setLevel=function(level){loggerLevel=level;};this.getLevel=function(){return loggerLevel;};}\r
115 Logger.prototype={trace:function(){this.log(Level.TRACE,arguments);},debug:function(){this.log(Level.DEBUG,arguments);},info:function(){this.log(Level.INFO,arguments);},warn:function(){this.log(Level.WARN,arguments);},error:function(){this.log(Level.ERROR,arguments);},fatal:function(){this.log(Level.FATAL,arguments);},isEnabledFor:function(level){return level.isGreaterOrEqual(this.getLevel());},isTraceEnabled:function(){return this.isEnabledFor(Level.TRACE);},isDebugEnabled:function(){return this.isEnabledFor(Level.DEBUG);},isInfoEnabled:function(){return this.isEnabledFor(Level.INFO);},isWarnEnabled:function(){return this.isEnabledFor(Level.WARN);},isErrorEnabled:function(){return this.isEnabledFor(Level.ERROR);},isFatalEnabled:function(){return this.isEnabledFor(Level.FATAL);}};var defaultLogger=null;log4javascript.getDefaultLogger=function(){if(!defaultLogger){defaultLogger=new Logger();}\r
116 return defaultLogger;};log4javascript.getLogger=log4javascript.getDefaultLogger;var nullLogger=null;log4javascript.getNullLogger=function(){if(!nullLogger){nullLogger=new Logger();nullLogger.setLevel(Level.OFF);}\r
117 return nullLogger;};var LoggingEvent=function(logger,timeStamp,level,messages,exception){this.logger=logger;this.timeStamp=timeStamp;this.level=level;this.messages=messages;this.exception=exception;};LoggingEvent.prototype={getThrowableStrRep:function(){return this.exception?getExceptionStringRep(this.exception):"";},getCombinedMessages:function(){return(this.messages.length===1)?this.messages[0]:this.messages.join(newLine);}};log4javascript.LoggingEvent=LoggingEvent;window.log4javascript=log4javascript;})();\r
118 </textarea>\r
119                                         <p class="visibleifabletocopy">\r
120                                                 Press this button to copy the code to the clipboard:\r
121                                                 <input type="button" value="Copy" onclick="copyCode()" />\r
122                                         </p>\r
123                                         <p>\r
124                                                 You can either paste the above code inside a script tag:\r
125                                         </p>\r
126                                         <pre class="code">\r
127 &lt;script type="text/javascript"&gt;\r
128         ... [Code here]...\r
129 &lt;/script&gt;\r
130 </pre>\r
131                                         <p>\r
132                                                  ... or include the <code>log4javascript_lite.js</code> included in the distribution:\r
133                                         </p>\r
134                                         <pre class="code">\r
135 &lt;script type="text/javascript" src="log4javascript_lite.js"&gt;&lt;/script&gt;\r
136 </pre>\r
137                                         <pre class="code">\r
138 &lt;script type="text/javascript"&gt;\r
139         var log = log4javascript.getDefaultLogger();\r
140 &lt;/script&gt;\r
141 </pre>\r
142                                         <p>\r
143                                                 Using log4javascript Lite is identical to using log4javascript with its default logger:\r
144                                         </p>\r
145                                         <pre class="code">\r
146 &lt;script type="text/javascript"&gt;\r
147         var log = log4javascript.getDefaultLogger();\r
148         log.debug("What's going on here then?");\r
149 &lt;/script&gt;\r
150 </pre>\r
151                                         <p class="linktotop">\r
152                                                 <a href="#container">Top</a>\r
153                                         </p>\r
154                                 </div>\r
155                                 <div id="api">\r
156                                         <h2>API</h2>\r
157                                         <p>\r
158                                                 The functions available in log4javascript Lite make up a small subset of those provided\r
159                                                 by log4javascript proper. Each function is <strong>named and called identically to the equivalent\r
160                                                 function in log4javascript</strong>. Full details can be found in the\r
161                                                 <a href="manual_lite.html">log4javascript Lite manual</a>.\r
162                                         </p>\r
163                                         <p class="linktotop">\r
164                                                 <a href="#container">Top</a>\r
165                                         </p>\r
166                                 </div>\r
167                         </div>\r
168                         <div id="footer">\r
169                                 <span class="externallinkinfo">\r
170                                         <strong>NB.</strong> All external links open in a new window.\r
171                                 </span>\r
172                                 Written by Tim Down. <a href="mailto:tim@log4javascript.org">tim@log4javascript.org</a>\r
173                                 <br />\r
174                                 log4javascript is distributed under the <a href="http://www.apache.org/licenses/LICENSE-2.0.html"\r
175                                         title="Apache License, Version 2.0 (opens in new window)" target="_blank">Apache License,\r
176                                         Version 2.0</a>\r
177 \r
178                         </div>\r
179                 </div>\r
180 \r
181         </body>\r
182 </html>\r