Files
cdnjs/ajax/libs/log4javascript/1.4.3/log4javascript_production.min.js
2013-04-14 11:51:00 +10:00

2 lines
33 KiB
JavaScript

Array.prototype.push||(Array.prototype.push=function(){for(var e=0,t=arguments.length;t>e;e++)this[this.length]=arguments[e];return this.length}),Array.prototype.shift||(Array.prototype.shift=function(){if(this.length>0){for(var e=this[0],t=0,i=this.length-1;i>t;t++)this[t]=this[t+1];return this.length=this.length-1,e}}),Array.prototype.splice||(Array.prototype.splice=function(e,t){var i=this.slice(e+t),n=this.slice(e,e+t);this.length=e;for(var r=[],o=0,s=arguments.length;s>o;o++)r[o]=arguments[o];var a=r.length>2?i=r.slice(2).concat(i):i;for(o=0,s=a.length;s>o;o++)this.push(a[o]);return n});var log4javascript=function(){function isUndefined(e){return e===void 0}function EventSupport(){}function Log4JavaScript(){}function toStr(e){return e&&e.toString?""+e:e+""}function getExceptionMessage(e){return e.message?e.message:e.description?e.description:toStr(e)}function getUrlFileName(e){var t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return e.substr(t+1)}function getExceptionStringRep(e){if(e){var t="Exception: "+getExceptionMessage(e);try{e.lineNumber&&(t+=" on line number "+e.lineNumber),e.fileName&&(t+=" in file "+getUrlFileName(e.fileName))}catch(i){logLog.warn("Unable to obtain file and line information for error")}return showStackTraces&&e.stack&&(t+=newLine+"Stack trace:"+newLine+e.stack),t}return null}function bool(e){return Boolean(e)}function trim(e){return e.replace(/^\s+/,"").replace(/\s+$/,"")}function splitIntoLines(e){var t=e.replace(/\r\n/g,"\n").replace(/\r/g,"\n");return t.split("\n")}function array_remove(e,t){for(var i=-1,n=0,r=e.length;r>n;n++)if(e[n]===t){i=n;break}return i>=0?(e.splice(i,1),!0):!1}function array_contains(e,t){for(var i=0,n=e.length;n>i;i++)if(e[i]==t)return!0;return!1}function extractBooleanFromParam(e,t){return isUndefined(e)?t:bool(e)}function extractStringFromParam(e,t){return isUndefined(e)?t:e+""}function extractIntFromParam(e,t){if(isUndefined(e))return t;try{var i=parseInt(e,10);return isNaN(i)?t:i}catch(n){return logLog.warn("Invalid int param "+e,n),t}}function extractFunctionFromParam(e,t){return"function"==typeof e?e:t}function isError(e){return e instanceof Error}function getListenersPropertyName(e){return"__log4javascript_listeners__"+e}function addEvent(e,t,i,n,r){if(r=r?r:window,e.addEventListener)e.addEventListener(t,i,n);else if(e.attachEvent)e.attachEvent("on"+t,i);else{var o=getListenersPropertyName(t);e[o]||(e[o]=[],e["on"+t]=function(e){e=getEvent(e,r);for(var i,n=getListenersPropertyName(t),o=this[n].concat([]);i=o.shift();)i.call(this,e)}),e[o].push(i)}}function removeEvent(e,t,i,n){if(e.removeEventListener)e.removeEventListener(t,i,n);else if(e.detachEvent)e.detachEvent("on"+t,i);else{var r=getListenersPropertyName(t);e[r]&&array_remove(e[r],i)}}function getEvent(e,t){return t=t?t:window,e?e:t.event}function stopEventPropagation(e){e.stopPropagation?e.stopPropagation():e.cancelBubble!==void 0&&(e.cancelBubble=!0),e.returnValue=!1}function handleError(e,t){logLog.error(e,t),log4javascript.dispatchEvent("error",{message:e,exception:t})}function Timer(e,t){this.name=e,this.level=isUndefined(t)?Level.INFO:t,this.start=new Date}function Logger(e){this.name=e,this.parent=null,this.children=[];var t=[],i=null,n=this.name===rootLoggerName,r=this.name===nullLoggerName,o=null,s=!1;this.addChild=function(e){this.children.push(e),e.parent=this,e.invalidateAppenderCache()};var a=!0;this.getAdditivity=function(){return a},this.setAdditivity=function(e){var t=a!=e;a=e,t&&this.invalidateAppenderCache()},this.addAppender=function(e){r?handleError("Logger.addAppender: you may not add an appender to the null logger"):e instanceof log4javascript.Appender?array_contains(t,e)||(t.push(e),e.setAddedToLogger(this),this.invalidateAppenderCache()):handleError("Logger.addAppender: appender supplied ('"+toStr(e)+"') is not a subclass of Appender")},this.removeAppender=function(e){array_remove(t,e),e.setRemovedFromLogger(this),this.invalidateAppenderCache()},this.removeAllAppenders=function(){var e=t.length;if(e>0){for(var i=0;e>i;i++)t[i].setRemovedFromLogger(this);t.length=0,this.invalidateAppenderCache()}},this.getEffectiveAppenders=function(){if(null===o||s){var e=n||!this.getAdditivity()?[]:this.parent.getEffectiveAppenders();o=e.concat(t),s=!1}return o},this.invalidateAppenderCache=function(){s=!0;for(var e=0,t=this.children.length;t>e;e++)this.children[e].invalidateAppenderCache()},this.log=function(e,t){if(enabled&&e.isGreaterOrEqual(this.getEffectiveLevel())){var i,n=t.length-1,r=t[n];t.length>1&&isError(r)&&(i=r,n--);for(var o=[],s=0;n>=s;s++)o[s]=t[s];var a=new LoggingEvent(this,new Date,e,o,i);this.callAppenders(a)}},this.callAppenders=function(e){for(var t=this.getEffectiveAppenders(),i=0,n=t.length;n>i;i++)t[i].doAppend(e)},this.setLevel=function(e){n&&null===e?handleError("Logger.setLevel: you cannot set the level of the root logger to null"):e instanceof Level?i=e:handleError("Logger.setLevel: level supplied to logger "+this.name+" is not an instance of log4javascript.Level")},this.getLevel=function(){return i},this.getEffectiveLevel=function(){for(var e=this;null!==e;e=e.parent){var t=e.getLevel();if(null!==t)return t}},this.group=function(e,t){if(enabled)for(var i=this.getEffectiveAppenders(),n=0,r=i.length;r>n;n++)i[n].group(e,t)},this.groupEnd=function(){if(enabled)for(var e=this.getEffectiveAppenders(),t=0,i=e.length;i>t;t++)e[t].groupEnd()};var l={};this.time=function(e,t){enabled&&(isUndefined(e)?handleError("Logger.time: a name for the timer must be supplied"):!t||t instanceof Level?l[e]=new Timer(e,t):handleError("Logger.time: level supplied to timer "+e+" is not an instance of log4javascript.Level"))},this.timeEnd=function(e){if(enabled)if(isUndefined(e))handleError("Logger.timeEnd: a name for the timer must be supplied");else if(l[e]){var t=l[e],i=t.getElapsedTime();this.log(t.level,["Timer "+toStr(e)+" completed in "+i+"ms"]),delete l[e]}else logLog.warn("Logger.timeEnd: no timer found with name "+e)},this.assert=function(e){if(enabled&&!e){for(var t=[],i=1,n=arguments.length;n>i;i++)t.push(arguments[i]);t=t.length>0?t:["Assertion Failure"],t.push(newLine),t.push(e),this.log(Level.ERROR,t)}},this.toString=function(){return"Logger["+this.name+"]"}}function SimpleLayout(){this.customFields=[]}function NullLayout(){this.customFields=[]}function XmlLayout(e){this.combineMessages=extractBooleanFromParam(e,!0),this.customFields=[]}function escapeNewLines(e){return e.replace(/\r\n|\r|\n/g,"\\r\\n")}function JsonLayout(e,t){this.readable=extractBooleanFromParam(e,!1),this.combineMessages=extractBooleanFromParam(t,!0),this.batchHeader=this.readable?"["+newLine:"[",this.batchFooter=this.readable?"]"+newLine:"]",this.batchSeparator=this.readable?","+newLine:",",this.setKeys(),this.colon=this.readable?": ":":",this.tab=this.readable?" ":"",this.lineBreak=this.readable?newLine:"",this.customFields=[]}function HttpPostDataLayout(){this.setKeys(),this.customFields=[],this.returnsPostData=!0}function formatObjectExpansion(e,t,i){function n(e,t,i){function o(e){for(var t=splitIntoLines(e),n=1,r=t.length;r>n;n++)t[n]=i+t[n];return t.join(newLine)}var s,a,l,c,h,u,d;if(i||(i=""),null===e)return"null";if(e===void 0)return"undefined";if("string"==typeof e)return o(e);if("object"==typeof e&&array_contains(r,e)){try{u=toStr(e)}catch(p){u="Error formatting property. Details: "+getExceptionStringRep(p)}return u+" [already expanded]"}if(e instanceof Array&&t>0){for(r.push(e),u="["+newLine,l=t-1,c=i+" ",h=[],s=0,a=e.length;a>s;s++)try{d=n(e[s],l,c),h.push(c+d)}catch(p){h.push(c+"Error formatting array member. Details: "+getExceptionStringRep(p))}return u+=h.join(","+newLine)+newLine+i+"]"}if("[object Date]"==Object.prototype.toString.call(e))return""+e;if("object"==typeof e&&t>0){r.push(e),u="{"+newLine,l=t-1,c=i+" ",h=[];for(s in e)try{d=n(e[s],l,c),h.push(c+s+": "+d)}catch(p){h.push(c+s+": Error formatting property. Details: "+getExceptionStringRep(p))}return u+=h.join(","+newLine)+newLine+i+"}"}return o(toStr(e))}var r=[];return n(e,t,i)}function PatternLayout(e){this.pattern=e?e:PatternLayout.DEFAULT_CONVERSION_PATTERN,this.customFields=[]}function isHttpRequestSuccessful(e){return isUndefined(e.status)||0===e.status||e.status>=200&&300>e.status}function AjaxAppender(e){function t(e){return k?(handleError("AjaxAppender: configuration option '"+e+"' may not be set after the appender has been initialized"),!1):!0}function i(){if(h&&enabled){w=!0;var e;if(d)_.length>0?(e=_.shift(),a(r(e),i)):(w=!1,u&&o());else{for(;e=_.shift();)a(r(e));w=!1,u&&o()}}}function n(){var e=!1;if(h&&enabled){for(var t,n=c.getLayout().allowBatching()?p:1,r=[];t=x.shift();)r.push(t),x.length>=n&&(_.push(r),r=[]);r.length>0&&_.push(r),e=_.length>0,d=!1,u=!1,i()}return e}function r(e){for(var t,i=[],n="";t=e.shift();){var r=c.getLayout().format(t);c.getLayout().ignoresThrowable()&&(r+=t.getThrowableStrRep()),i.push(r)}return n=1==e.length?i.join(""):c.getLayout().batchHeader+i.join(c.getLayout().batchSeparator)+c.getLayout().batchFooter,n=c.getLayout().returnsPostData?n:urlEncode(v)+"="+urlEncode(n),n.length>0&&(n+="&"),n+"layout="+urlEncode(""+c.getLayout())}function o(){window.setTimeout(i,f)}function s(){var e="AjaxAppender: could not create XMLHttpRequest object. AjaxAppender disabled";handleError(e),h=!1,m&&m(e)}function a(t,i){try{var n=getXmlHttp(s);if(h){n.overrideMimeType&&n.overrideMimeType(c.getLayout().getContentType()),n.onreadystatechange=function(){if(4==n.readyState){if(isHttpRequestSuccessful(n))g&&g(n),i&&i(n);else{var t="AjaxAppender.append: XMLHttpRequest request to URL "+e+" returned status code "+n.status;handleError(t),m&&m(t)}n.onreadystatechange=emptyFunction,n=null}},n.open("POST",e,!0);try{n.setRequestHeader("Content-Type","application/x-www-form-urlencoded");for(var r,o=0;r=C[o++];)n.setRequestHeader(r.name,r.value)}catch(a){var l="AjaxAppender.append: your browser's XMLHttpRequest implementation does not support setRequestHeader, therefore cannot post data. AjaxAppender disabled";return handleError(l),h=!1,m&&m(l),void 0}n.send(t)}}catch(u){var d="AjaxAppender.append: error sending log message to "+e;handleError(d,u),h=!1,m&&m(d+". Details: "+getExceptionStringRep(u))}}function l(){if(k=!0,b){var e=window.onbeforeunload;window.onbeforeunload=function(){return e&&e(),n()?"Sending log messages":void 0}}u&&o()}var c=this,h=!0;e||(handleError("AjaxAppender: URL must be specified in constructor"),h=!1);var u=this.defaults.timed,d=this.defaults.waitForResponse,p=this.defaults.batchSize,f=this.defaults.timerInterval,g=this.defaults.requestSuccessCallback,m=this.defaults.failCallback,v=this.defaults.postVarName,b=this.defaults.sendAllOnUnload,y=null,x=[],_=[],C=[],w=!1,k=!1;this.getSessionId=function(){return y},this.setSessionId=function(e){y=extractStringFromParam(e,null),this.layout.setCustomField("sessionid",y)},this.setLayout=function(e){t("layout")&&(this.layout=e,null!==y&&this.setSessionId(y))},this.isTimed=function(){return u},this.setTimed=function(e){t("timed")&&(u=bool(e))},this.getTimerInterval=function(){return f},this.setTimerInterval=function(e){t("timerInterval")&&(f=extractIntFromParam(e,f))},this.isWaitForResponse=function(){return d},this.setWaitForResponse=function(e){t("waitForResponse")&&(d=bool(e))},this.getBatchSize=function(){return p},this.setBatchSize=function(e){t("batchSize")&&(p=extractIntFromParam(e,p))},this.isSendAllOnUnload=function(){return b},this.setSendAllOnUnload=function(e){t("sendAllOnUnload")&&(b=extractBooleanFromParam(e,b))},this.setRequestSuccessCallback=function(e){g=extractFunctionFromParam(e,g)},this.setFailCallback=function(e){m=extractFunctionFromParam(e,m)},this.getPostVarName=function(){return v},this.setPostVarName=function(e){t("postVarName")&&(v=extractStringFromParam(e,v))},this.getHeaders=function(){return C},this.addHeader=function(e,t){C.push({name:e,value:t})},this.sendAll=i,this.append=function(e){if(h){k||l(),x.push(e);var t=this.getLayout().allowBatching()?p:1;if(x.length>=t){for(var n,r=[];n=x.shift();)r.push(n);_.push(r),u||d&&(!d||w)||i()}}}}EventSupport.prototype={eventTypes:[],eventListeners:{},setEventTypes:function(e){if(e instanceof Array){this.eventTypes=e,this.eventListeners={};for(var t=0,i=this.eventTypes.length;i>t;t++)this.eventListeners[this.eventTypes[t]]=[]}else handleError("log4javascript.EventSupport ["+this+"]: setEventTypes: eventTypes parameter must be an Array")},addEventListener:function(e,t){"function"==typeof t?(array_contains(this.eventTypes,e)||handleError("log4javascript.EventSupport ["+this+"]: addEventListener: no event called '"+e+"'"),this.eventListeners[e].push(t)):handleError("log4javascript.EventSupport ["+this+"]: addEventListener: listener must be a function")},removeEventListener:function(e,t){"function"==typeof t?(array_contains(this.eventTypes,e)||handleError("log4javascript.EventSupport ["+this+"]: removeEventListener: no event called '"+e+"'"),array_remove(this.eventListeners[e],t)):handleError("log4javascript.EventSupport ["+this+"]: removeEventListener: listener must be a function")},dispatchEvent:function(e,t){if(array_contains(this.eventTypes,e))for(var i=this.eventListeners[e],n=0,r=i.length;r>n;n++)i[n](this,e,t);else handleError("log4javascript.EventSupport ["+this+"]: dispatchEvent: no event called '"+e+"'")}};var applicationStartDate=new Date,uniqueId="log4javascript_"+applicationStartDate.getTime()+"_"+Math.floor(1e8*Math.random()),emptyFunction=function(){},newLine="\r\n",pageLoaded=!1;Log4JavaScript.prototype=new EventSupport,log4javascript=new Log4JavaScript,log4javascript.version="1.4.3",log4javascript.edition="log4javascript_production";var urlEncode=window.encodeURIComponent!==void 0?function(e){return encodeURIComponent(e)}:function(e){return escape(e).replace(/\+/g,"%2B").replace(/"/g,"%22").replace(/'/g,"%27").replace(/\//g,"%2F").replace(/=/g,"%3D")},urlDecode=window.decodeURIComponent!==void 0?function(e){return decodeURIComponent(e)}:function(e){return unescape(e).replace(/%2B/g,"+").replace(/%22/g,'"').replace(/%27/g,"'").replace(/%2F/g,"/").replace(/%3D/g,"=")};Function.prototype.apply||(Function.prototype.apply=function(obj,args){var methodName="__apply__";obj[methodName]!==void 0&&(methodName+=(Math.random()+"").substr(2)),obj[methodName]=this;for(var argsStrings=[],i=0,len=args.length;len>i;i++)argsStrings[i]="args["+i+"]";var script="obj."+methodName+"("+argsStrings.join(",")+")",returnValue=eval(script);return delete obj[methodName],returnValue}),Function.prototype.call||(Function.prototype.call=function(e){for(var t=[],i=1,n=arguments.length;n>i;i++)t[i-1]=arguments[i];return this.apply(e,t)});var logLog={quietMode:!1,debugMessages:[],setQuietMode:function(e){this.quietMode=bool(e)},numberOfErrors:0,alertAllErrors:!1,setAlertAllErrors:function(e){this.alertAllErrors=e},debug:function(e){this.debugMessages.push(e)},displayDebug:function(){alert(this.debugMessages.join(newLine))},warn:function(){},error:function(e,t){if((1==++this.numberOfErrors||this.alertAllErrors)&&!this.quietMode){var i="log4javascript error: "+e;t&&(i+=newLine+newLine+"Original error: "+getExceptionStringRep(t)),alert(i)}}};log4javascript.logLog=logLog,log4javascript.setEventTypes(["load","error"]),log4javascript.handleError=handleError;var enabled=!("undefined"!=typeof log4javascript_disabled&&log4javascript_disabled);log4javascript.setEnabled=function(e){enabled=bool(e)},log4javascript.isEnabled=function(){return enabled};var useTimeStampsInMilliseconds=!0;log4javascript.setTimeStampsInMilliseconds=function(e){useTimeStampsInMilliseconds=bool(e)},log4javascript.isTimeStampsInMilliseconds=function(){return useTimeStampsInMilliseconds},log4javascript.evalInScope=function(expr){return eval(expr)};var showStackTraces=!1;log4javascript.setShowStackTraces=function(e){showStackTraces=bool(e)};var Level=function(e,t){this.level=e,this.name=t};Level.prototype={toString:function(){return this.name},equals:function(e){return this.level==e.level},isGreaterOrEqual:function(e){return this.level>=e.level}},Level.ALL=new Level(Number.MIN_VALUE,"ALL"),Level.TRACE=new Level(1e4,"TRACE"),Level.DEBUG=new Level(2e4,"DEBUG"),Level.INFO=new Level(3e4,"INFO"),Level.WARN=new Level(4e4,"WARN"),Level.ERROR=new Level(5e4,"ERROR"),Level.FATAL=new Level(6e4,"FATAL"),Level.OFF=new Level(Number.MAX_VALUE,"OFF"),log4javascript.Level=Level,Timer.prototype.getElapsedTime=function(){return(new Date).getTime()-this.start.getTime()};var anonymousLoggerName="[anonymous]",defaultLoggerName="[default]",nullLoggerName="[null]",rootLoggerName="root";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(e){return e.isGreaterOrEqual(this.getEffectiveLevel())},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)}},Logger.prototype.trace.isEntryPoint=!0,Logger.prototype.debug.isEntryPoint=!0,Logger.prototype.info.isEntryPoint=!0,Logger.prototype.warn.isEntryPoint=!0,Logger.prototype.error.isEntryPoint=!0,Logger.prototype.fatal.isEntryPoint=!0;var loggers={},loggerNames=[],ROOT_LOGGER_DEFAULT_LEVEL=Level.DEBUG,rootLogger=new Logger(rootLoggerName);rootLogger.setLevel(ROOT_LOGGER_DEFAULT_LEVEL),log4javascript.getRootLogger=function(){return rootLogger},log4javascript.getLogger=function(e){if("string"!=typeof e&&(e=anonymousLoggerName,logLog.warn("log4javascript.getLogger: non-string logger name "+toStr(e)+" supplied, returning anonymous logger")),e==rootLoggerName&&handleError("log4javascript.getLogger: root logger may not be obtained by name"),!loggers[e]){var t=new Logger(e);loggers[e]=t,loggerNames.push(e);var i,n=e.lastIndexOf(".");if(n>-1){var r=e.substring(0,n);i=log4javascript.getLogger(r)}else i=rootLogger;i.addChild(t)}return loggers[e]};var defaultLogger=null;log4javascript.getDefaultLogger=function(){if(!defaultLogger){defaultLogger=log4javascript.getLogger(defaultLoggerName);var e=new log4javascript.PopUpAppender;defaultLogger.addAppender(e)}return defaultLogger};var nullLogger=null;log4javascript.getNullLogger=function(){return nullLogger||(nullLogger=new Logger(nullLoggerName),nullLogger.setLevel(Level.OFF)),nullLogger},log4javascript.resetConfiguration=function(){rootLogger.setLevel(ROOT_LOGGER_DEFAULT_LEVEL),loggers={}};var LoggingEvent=function(e,t,i,n,r){this.logger=e,this.timeStamp=t,this.timeStampInMilliseconds=t.getTime(),this.timeStampInSeconds=Math.floor(this.timeStampInMilliseconds/1e3),this.milliseconds=this.timeStamp.getMilliseconds(),this.level=i,this.messages=n,this.exception=r};LoggingEvent.prototype={getThrowableStrRep:function(){return this.exception?getExceptionStringRep(this.exception):""},getCombinedMessages:function(){return 1==this.messages.length?this.messages[0]:this.messages.join(newLine)},toString:function(){return"LoggingEvent["+this.level+"]"}},log4javascript.LoggingEvent=LoggingEvent;var Layout=function(){};Layout.prototype={defaults:{loggerKey:"logger",timeStampKey:"timestamp",millisecondsKey:"milliseconds",levelKey:"level",messageKey:"message",exceptionKey:"exception",urlKey:"url"},loggerKey:"logger",timeStampKey:"timestamp",millisecondsKey:"milliseconds",levelKey:"level",messageKey:"message",exceptionKey:"exception",urlKey:"url",batchHeader:"",batchFooter:"",batchSeparator:"",returnsPostData:!1,overrideTimeStampsSetting:!1,useTimeStampsInMilliseconds:null,format:function(){handleError("Layout.format: layout supplied has no format() method")},ignoresThrowable:function(){handleError("Layout.ignoresThrowable: layout supplied has no ignoresThrowable() method")},getContentType:function(){return"text/plain"},allowBatching:function(){return!0},setTimeStampsInMilliseconds:function(e){this.overrideTimeStampsSetting=!0,this.useTimeStampsInMilliseconds=bool(e)},isTimeStampsInMilliseconds:function(){return this.overrideTimeStampsSetting?this.useTimeStampsInMilliseconds:useTimeStampsInMilliseconds},getTimeStampValue:function(e){return this.isTimeStampsInMilliseconds()?e.timeStampInMilliseconds:e.timeStampInSeconds},getDataValues:function(e,t){var i=[[this.loggerKey,e.logger.name],[this.timeStampKey,this.getTimeStampValue(e)],[this.levelKey,e.level.name],[this.urlKey,window.location.href],[this.messageKey,t?e.getCombinedMessages():e.messages]];if(this.isTimeStampsInMilliseconds()||i.push([this.millisecondsKey,e.milliseconds]),e.exception&&i.push([this.exceptionKey,getExceptionStringRep(e.exception)]),this.hasCustomFields())for(var n=0,r=this.customFields.length;r>n;n++){var o=this.customFields[n].value;"function"==typeof o&&(o=o(this,e)),i.push([this.customFields[n].name,o])}return i},setKeys:function(e,t,i,n,r,o,s){this.loggerKey=extractStringFromParam(e,this.defaults.loggerKey),this.timeStampKey=extractStringFromParam(t,this.defaults.timeStampKey),this.levelKey=extractStringFromParam(i,this.defaults.levelKey),this.messageKey=extractStringFromParam(n,this.defaults.messageKey),this.exceptionKey=extractStringFromParam(r,this.defaults.exceptionKey),this.urlKey=extractStringFromParam(o,this.defaults.urlKey),this.millisecondsKey=extractStringFromParam(s,this.defaults.millisecondsKey)},setCustomField:function(e,t){for(var i=!1,n=0,r=this.customFields.length;r>n;n++)this.customFields[n].name===e&&(this.customFields[n].value=t,i=!0);i||this.customFields.push({name:e,value:t})},hasCustomFields:function(){return this.customFields.length>0},toString:function(){handleError("Layout.toString: all layouts must override this method")}},log4javascript.Layout=Layout;var Appender=function(){};Appender.prototype=new EventSupport,Appender.prototype.layout=new PatternLayout,Appender.prototype.threshold=Level.ALL,Appender.prototype.loggers=[],Appender.prototype.doAppend=function(e){enabled&&e.level.level>=this.threshold.level&&this.append(e)},Appender.prototype.append=function(){},Appender.prototype.setLayout=function(e){e instanceof Layout?this.layout=e:handleError("Appender.setLayout: layout supplied to "+(""+this)+" is not a subclass of Layout")},Appender.prototype.getLayout=function(){return this.layout},Appender.prototype.setThreshold=function(e){e instanceof Level?this.threshold=e:handleError("Appender.setThreshold: threshold supplied to "+(""+this)+" is not a subclass of Level")},Appender.prototype.getThreshold=function(){return this.threshold},Appender.prototype.setAddedToLogger=function(e){this.loggers.push(e)},Appender.prototype.setRemovedFromLogger=function(e){array_remove(this.loggers,e)},Appender.prototype.group=emptyFunction,Appender.prototype.groupEnd=emptyFunction,Appender.prototype.toString=function(){handleError("Appender.toString: all appenders must override this method")},log4javascript.Appender=Appender,SimpleLayout.prototype=new Layout,SimpleLayout.prototype.format=function(e){return e.level.name+" - "+e.getCombinedMessages()},SimpleLayout.prototype.ignoresThrowable=function(){return!0},SimpleLayout.prototype.toString=function(){return"SimpleLayout"},log4javascript.SimpleLayout=SimpleLayout,NullLayout.prototype=new Layout,NullLayout.prototype.format=function(e){return e.messages},NullLayout.prototype.ignoresThrowable=function(){return!0},NullLayout.prototype.toString=function(){return"NullLayout"},log4javascript.NullLayout=NullLayout,XmlLayout.prototype=new Layout,XmlLayout.prototype.isCombinedMessages=function(){return this.combineMessages},XmlLayout.prototype.getContentType=function(){return"text/xml"},XmlLayout.prototype.escapeCdata=function(e){return e.replace(/\]\]>/,"]]>]]&gt;<![CDATA[")},XmlLayout.prototype.format=function(e){function t(e){return e="string"==typeof e?e:toStr(e),"<log4javascript:message><![CDATA["+r.escapeCdata(e)+"]]></log4javascript:message>"}var i,n,r=this,o='<log4javascript:event logger="'+e.logger.name+'" timestamp="'+this.getTimeStampValue(e)+'"';if(this.isTimeStampsInMilliseconds()||(o+=' milliseconds="'+e.milliseconds+'"'),o+=' level="'+e.level.name+'">'+newLine,this.combineMessages)o+=t(e.getCombinedMessages());else{for(o+="<log4javascript:messages>"+newLine,i=0,n=e.messages.length;n>i;i++)o+=t(e.messages[i])+newLine;o+="</log4javascript:messages>"+newLine}if(this.hasCustomFields())for(i=0,n=this.customFields.length;n>i;i++)o+='<log4javascript:customfield name="'+this.customFields[i].name+'"><![CDATA['+(""+this.customFields[i].value)+"]]></log4javascript:customfield>"+newLine;return e.exception&&(o+="<log4javascript:exception><![CDATA["+getExceptionStringRep(e.exception)+"]]></log4javascript:exception>"+newLine),o+="</log4javascript:event>"+newLine+newLine},XmlLayout.prototype.ignoresThrowable=function(){return!1},XmlLayout.prototype.toString=function(){return"XmlLayout"},log4javascript.XmlLayout=XmlLayout,JsonLayout.prototype=new Layout,JsonLayout.prototype.isReadable=function(){return this.readable},JsonLayout.prototype.isCombinedMessages=function(){return this.combineMessages},JsonLayout.prototype.format=function(e){function t(e,i,n){var o,s=typeof e;if(e instanceof Date)o=e.getTime()+"";else if(n&&e instanceof Array){o="["+r.lineBreak;for(var a=0,l=e.length;l>a;a++){var c=i+r.tab;o+=c+t(e[a],c,!1),e.length-1>a&&(o+=","),o+=r.lineBreak}o+=i+"]"}else o="number"!==s&&"boolean"!==s?'"'+escapeNewLines(toStr(e).replace(/\"/g,'\\"'))+'"':e;return o}var i,n,r=this,o=this.getDataValues(e,this.combineMessages),s="{"+this.lineBreak;for(i=0,n=o.length-1;n>=i;i++)s+=this.tab+'"'+o[i][0]+'"'+this.colon+t(o[i][1],this.tab,!0),n>i&&(s+=","),s+=this.lineBreak;return s+="}"+this.lineBreak},JsonLayout.prototype.ignoresThrowable=function(){return!1},JsonLayout.prototype.toString=function(){return"JsonLayout"},JsonLayout.prototype.getContentType=function(){return"application/json"},log4javascript.JsonLayout=JsonLayout,HttpPostDataLayout.prototype=new Layout,HttpPostDataLayout.prototype.allowBatching=function(){return!1},HttpPostDataLayout.prototype.format=function(e){for(var t=this.getDataValues(e),i=[],n=0,r=t.length;r>n;n++){var o=t[n][1]instanceof Date?t[n][1].getTime()+"":t[n][1];i.push(urlEncode(t[n][0])+"="+urlEncode(o))}return i.join("&")},HttpPostDataLayout.prototype.ignoresThrowable=function(){return!1},HttpPostDataLayout.prototype.toString=function(){return"HttpPostDataLayout"},log4javascript.HttpPostDataLayout=HttpPostDataLayout;var SimpleDateFormat;(function(){var e=/('[^']*')|(G+|y+|M+|w+|W+|D+|d+|F+|E+|a+|H+|k+|K+|h+|m+|s+|S+|Z+)|([a-zA-Z]+)|([^a-zA-Z']+)/,t=["January","February","March","April","May","June","July","August","September","October","November","December"],i=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],n=0,r=1,o=2,s=3,a=4,l=5,c={G:n,y:s,M:a,w:o,W:o,D:o,d:o,F:o,E:r,a:n,H:o,k:o,K:o,h:o,m:o,s:o,S:o,Z:l},h=864e5,u=7*h,d=1,p=function(e,t,i){var n=new Date(e,t,i,0,0,0);return n.setMilliseconds(0),n};Date.prototype.getDifference=function(e){return this.getTime()-e.getTime()},Date.prototype.isBefore=function(e){return this.getTime()<e.getTime()},Date.prototype.getUTCTime=function(){return Date.UTC(this.getFullYear(),this.getMonth(),this.getDate(),this.getHours(),this.getMinutes(),this.getSeconds(),this.getMilliseconds())},Date.prototype.getTimeSince=function(e){return this.getUTCTime()-e.getUTCTime()},Date.prototype.getPreviousSunday=function(){var e=new Date(this.getFullYear(),this.getMonth(),this.getDate(),12,0,0),t=new Date(e.getTime()-this.getDay()*h);return p(t.getFullYear(),t.getMonth(),t.getDate())},Date.prototype.getWeekInYear=function(e){isUndefined(this.minimalDaysInFirstWeek)&&(e=d);var t=this.getPreviousSunday(),i=p(this.getFullYear(),0,1),n=t.isBefore(i)?0:1+Math.floor(t.getTimeSince(i)/u),r=7-i.getDay(),o=n;return e>r&&o--,o},Date.prototype.getWeekInMonth=function(e){isUndefined(this.minimalDaysInFirstWeek)&&(e=d);var t=this.getPreviousSunday(),i=p(this.getFullYear(),this.getMonth(),1),n=t.isBefore(i)?0:1+Math.floor(t.getTimeSince(i)/u),r=7-i.getDay(),o=n;return r>=e&&o++,o},Date.prototype.getDayInYear=function(){var e=p(this.getFullYear(),0,1);return 1+Math.floor(this.getTimeSince(e)/h)},SimpleDateFormat=function(e){this.formatString=e},SimpleDateFormat.prototype.setMinimalDaysInFirstWeek=function(e){this.minimalDaysInFirstWeek=e},SimpleDateFormat.prototype.getMinimalDaysInFirstWeek=function(){return isUndefined(this.minimalDaysInFirstWeek)?d:this.minimalDaysInFirstWeek};var f=function(e,t){for(;t>e.length;)e="0"+e;return e},g=function(e,t,i){return t>=4?e:e.substr(0,Math.max(i,t))},m=function(e,t){var i=""+e;return f(i,t)};SimpleDateFormat.prototype.format=function(h){for(var u,d="",p=this.formatString;u=e.exec(p);){var v=u[1],b=u[2],y=u[3],x=u[4];if(v)d+="''"==v?"'":v.substring(1,v.length-1);else if(y);else if(x)d+=x;else if(b){var _=b.charAt(0),C=b.length,w="";switch(_){case"G":w="AD";break;case"y":w=h.getFullYear();break;case"M":w=h.getMonth();break;case"w":w=h.getWeekInYear(this.getMinimalDaysInFirstWeek());break;case"W":w=h.getWeekInMonth(this.getMinimalDaysInFirstWeek());break;case"D":w=h.getDayInYear();break;case"d":w=h.getDate();break;case"F":w=1+Math.floor((h.getDate()-1)/7);break;case"E":w=i[h.getDay()];break;case"a":w=h.getHours()>=12?"PM":"AM";break;case"H":w=h.getHours();break;case"k":w=h.getHours()||24;break;case"K":w=h.getHours()%12;break;case"h":w=h.getHours()%12||12;break;case"m":w=h.getMinutes();break;case"s":w=h.getSeconds();break;case"S":w=h.getMilliseconds();break;case"Z":w=h.getTimezoneOffset()}switch(c[_]){case n:d+=g(w,C,2);break;case r:d+=g(w,C,3);break;case o:d+=m(w,C);break;case s:if(3>=C){var k=""+w;d+=k.substr(2,2)}else d+=m(w,C);break;case a:d+=C>=3?g(t[w],C,C):m(w+1,C);break;case l:var T=w>0,E=T?"-":"+",S=Math.abs(w),P=""+Math.floor(S/60);P=f(P,2);var A=""+S%60;A=f(A,2),d+=E+P+A}}p=p.substr(u.index+u[0].length)}return d}})(),log4javascript.SimpleDateFormat=SimpleDateFormat,PatternLayout.TTCC_CONVERSION_PATTERN="%r %p %c - %m%n",PatternLayout.DEFAULT_CONVERSION_PATTERN="%m%n",PatternLayout.ISO8601_DATEFORMAT="yyyy-MM-dd HH:mm:ss,SSS",PatternLayout.DATETIME_DATEFORMAT="dd MMM yyyy HH:mm:ss,SSS",PatternLayout.ABSOLUTETIME_DATEFORMAT="HH:mm:ss,SSS",PatternLayout.prototype=new Layout,PatternLayout.prototype.format=function(e){for(var t,i=/%(-?[0-9]+)?(\.?[0-9]+)?([acdfmMnpr%])(\{([^\}]+)\})?|([^%]+)/,n="",r=this.pattern;t=i.exec(r);){var o=t[0],s=t[1],a=t[2],l=t[3],c=t[5],h=t[6];if(h)n+=""+h;else{var u="";switch(l){case"a":case"m":var d=0;c&&(d=parseInt(c,10),isNaN(d)&&(handleError("PatternLayout.format: invalid specifier '"+c+"' for conversion character '"+l+"' - should be a number"),d=0));for(var p="a"===l?e.messages[0]:e.messages,f=0,g=p.length;g>f;f++)f>0&&" "!==u.charAt(u.length-1)&&(u+=" "),u+=0===d?p[f]:formatObjectExpansion(p[f],d);break;case"c":var m=e.logger.name;if(c){var v=parseInt(c,10),b=e.logger.name.split(".");u=v>=b.length?m:b.slice(b.length-v).join(".")}else u=m;break;case"d":var y=PatternLayout.ISO8601_DATEFORMAT;c&&(y=c,"ISO8601"==y?y=PatternLayout.ISO8601_DATEFORMAT:"ABSOLUTE"==y?y=PatternLayout.ABSOLUTETIME_DATEFORMAT:"DATE"==y&&(y=PatternLayout.DATETIME_DATEFORMAT)),u=new SimpleDateFormat(y).format(e.timeStamp);break;case"f":if(this.hasCustomFields()){var x=0;c&&(x=parseInt(c,10),isNaN(x)?handleError("PatternLayout.format: invalid specifier '"+c+"' for conversion character 'f' - should be a number"):0===x?handleError("PatternLayout.format: invalid specifier '"+c+"' for conversion character 'f' - must be greater than zero"):x>this.customFields.length?handleError("PatternLayout.format: invalid specifier '"+c+"' for conversion character 'f' - there aren't that many custom fields"):x-=1);var _=this.customFields[x].value;"function"==typeof _&&(_=_(this,e)),u=_
}break;case"n":u=newLine;break;case"p":u=e.level.name;break;case"r":u=""+e.timeStamp.getDifference(applicationStartDate);break;case"%":u="%";break;default:u=o}var C;if(a){C=parseInt(a.substr(1),10);var w=u.length;w>C&&(u=u.substring(w-C,w))}if(s)if("-"==s.charAt(0))for(C=parseInt(s.substr(1),10);C>u.length;)u+=" ";else for(C=parseInt(s,10);C>u.length;)u=" "+u;n+=u}r=r.substr(t.index+t[0].length)}return n},PatternLayout.prototype.ignoresThrowable=function(){return!0},PatternLayout.prototype.toString=function(){return"PatternLayout"},log4javascript.PatternLayout=PatternLayout;var xmlHttpFactories=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}],getXmlHttp=function(e){for(var t,i=null,n=0,r=xmlHttpFactories.length;r>n;n++){t=xmlHttpFactories[n];try{return i=t(),getXmlHttp=t,i}catch(o){}}e?e():handleError("getXmlHttp: unable to obtain XMLHttpRequest object")};if(AjaxAppender.prototype=new Appender,AjaxAppender.prototype.defaults={waitForResponse:!1,timed:!1,timerInterval:1e3,batchSize:1,sendAllOnUnload:!1,requestSuccessCallback:null,failCallback:null,postVarName:"data"},AjaxAppender.prototype.layout=new HttpPostDataLayout,AjaxAppender.prototype.toString=function(){return"AjaxAppender"},log4javascript.AjaxAppender=AjaxAppender,log4javascript.setDocumentReady=function(){pageLoaded=!0,log4javascript.dispatchEvent("load",{})},window.addEventListener)window.addEventListener("load",log4javascript.setDocumentReady,!1);else if(window.attachEvent)window.attachEvent("onload",log4javascript.setDocumentReady);else{var oldOnload=window.onload;window.onload="function"!=typeof window.onload?log4javascript.setDocumentReady:function(e){oldOnload&&oldOnload(e),log4javascript.setDocumentReady()}}return window.log4javascript=log4javascript,log4javascript}();