Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
(function(f){if(typeof f.WicketClientSideLogging==="object"){return}var g,d,s,m=0;var v=[];var a=f.onerror;f.onerror=function(F,E,D){v.push({message:F,file:E,line:D,timestamp:y()})};var c=["off","error","warn","info","debug","trace"];var C={};var b={error:function(D){this.log(C.LVL_ERROR,D,z())},errorWithoutStack:function(D){this.log(C.LVL_ERROR,D,"")},warn:function(D){this.log(C.LVL_WARN,D,"")},info:function(D){this.log(C.LVL_INFO,D,"")},debug:function(D){this.log(C.LVL_DEBUG,D,"")},trace:function(D){this.log(C.LVL_TRACE,D,"")},log:function(D,G,F){if(this.isLoggingActive(D)){var H=c[D];var E={lvl:H,stack:F};if(typeof G==="string"){E.msg=G}else{if(typeof G==="object"){E.msg=G.message;E.file=G.file;E.line=G.line}else{E.message=G+""}}e(E)}if(o.debug===true){this.consoleLog(D,G,F)}},consoleLog:function(E,G,F){var D=c[E];if(f.console){var H="["+D+"] "+this.messageToString(G);if(F){H+="\n"+F}if(f.console[D]){f.console[D](H)}else{if(f.console.log){f.console.log(H)}}}},messageToString:function(D){if(typeof D==="object"){return D.message+" on ["+D.file+":"+D.line+"]"}else{return D+""}},isLoggingActive:function(D){return o.logLevel>0&&o.logLevel>=D&&o.maxEntriesPerPage>(m+x.length)}};var B={single:function(D){i([D],true)},timer:function(D){x.push(D)},size:function(D){x.push(D);if(x.length>=o.maxQueueSize){q(true)}},unload:function(D){x.push(D)},localstorage:function(E){var D=s.store("clientside-logging");if(!D){D=[]}D.push(E);s.store("clientside-logging",D)}};var x=[],w=0;var o={replaceWicketLog:false,replaceWindowOnError:false,wrapWindowOnError:true,wrapWicketLog:true,flushMessagesOnUnload:true,logStacktrace:false,logAdditionalErrors:true,dateFormat:null,collectClientInfos:true,logLevel:b.LVL_ERROR,url:null,method:"POST",maxQueueSize:10,maxEntriesPerPage:50,loggerName:"Log",customFilter:null,debug:false,collectionTimer:5000,collectionType:"single"};function n(E){var F=[],D;for(D in B){if(B.hasOwnProperty(D)){F.push(D)}}return"Invalid collection type: "+E+"; must be one of: ["+F.join(", ")+"]"}function y(){return o.dateFormat?moment().format(o.dateFormat):+(new Date())}function e(E){var D=o.collectionType;E.timestamp=y();if(B.hasOwnProperty(D)){B[D](E)}}function q(E){if(o.collectionType==="localstorage"){var D=s.store("clientside-logging");if(D&&D.length>0){i(D,E);s.store("clientside-logging",null)}}else{i(x,E)}}function l(D){var F=k({}),E=1;while(D.length>0){var G=D.pop();if(p(G)){F["timestamp_"+E]=G.timestamp;F["msg_"+E]=G.msg;F["lvl_"+E]=G.lvl;if(G.line){F["line_"+E]=G.line}if(G.file){F["file_"+E]=G.file}if(o.logStacktrace&&G.stack){F["stack_"+E]=G.stack}E++}}return F}function i(F,D){if(!F||F.length<=0){return}var E=l(F);if(!E||E.length<=0){return}m=m+E.length;D=D!==false;g.ajax({type:o.method,url:o.url,cache:false,async:D,dataType:"text",data:E})}function p(D){return D!=null&&typeof o.customFilter==="function"&&o.customFilter(D)}function z(){if(o.logStacktrace&&f.printStackTrace){return f.printStackTrace().join("\n")}return""}function k(D){D.ajaxBaseUrl=d.Ajax.baseUrl||".";if(o.collectClientInfos===true){D.ua=navigator.userAgent;D.winSize=g(f).width()+"x"+g(f).height();D.screenSize=f.screen.availWidth+"x"+f.screen.availHeight}return D}var t={isManipulated:true,origWicketLog:null,override:function(D){this.origWicketLog=D;return this},enabled:function(){return this.origWicketLog.enabled()},info:function(D){b.info(D);if(o.wrapWicketLog===true&&this.origWicketLog){this.origWicketLog.info(D)}},error:function(D){b.error(D);if(o.wrapWicketLog===true&&this.origWicketLog){this.origWicketLog.error(D)}},log:function(D){b.info(D);if(o.wrapWicketLog===true&&this.origWicketLog){this.origWicketLog.log(D)}}};function h(D){return function(G,F,E){w++;if(w===1||o.logAdditionalErrors){b.errorWithoutStack({message:G,file:F,line:E})}if(o.wrapWindowOnError===true&&D){try{D.call(this,G,F,E)}catch(H){}}}}function r(E){if(typeof E==="string"){var D="LVL_"+E.toUpperCase();if(C.hasOwnProperty(D)){E=C[D]}}if(typeof E!=="number"){E=C.LVL_ERROR}return Math.max(0,Math.floor(E))}function u(F){if(F.indexOf(".")>-1){var H=F.split(".");for(var E=0,D=H.length,G=window;E<D;++E){if(G[H[E]]){G=G[H[E]]}else{return null}}return typeof G==="function"?G:null}else{if(typeof window[F]==="function"){return window[F]}}return null}function j(H,D,F,E){g=H;d=D;s=F;g.each(c,function(J,I){C["LVL_"+I.toUpperCase()]=J});g.extend(b,C);g.extend(o,E||{});if(typeof o.customFilter==="function"){}else{if(typeof o.customFilter==="string"&&o.customFilter.indexOf("return")==0){o.customFilter=new Function("event",o.customFilter)}else{if(typeof o.customFilter==="string"){o.customFilter=u(o.customFilter)}else{o.customFilter=null}}}if(!o.url){throw new Error("there's no valid url set: "+o.url)}if(!B.hasOwnProperty(o.collectionType)){throw new Error(n(o.collectionType))}o.logLevel=r(o.logLevel);f.onerror=a;if(o.wrapWindowOnError===true||o.replaceWindowOnError===true){f.onerror=h(f.onerror);while(v&&v.length>0){var G=v.pop();f.onerror(G.message,G.file,G.line)}}else{v=[]}if((o.wrapWicketLog===true||o.replaceWicketLog===true)&&(!d.Log||d.Log.isManipulated!==true)){d.Log=t.override(d.Log)}if(o.collectionType==="timer"){f.setInterval(function(){q(true)},o.collectionTimer)}if(o.collectionType==="localstorage"){if(!s){throw new Error("can't use collection type 'localeStorage' without amplify.")}g(f).load(function(){f.setTimeout(function(){q(true)},500)});o.flushMessagesOnUnload=false}if(o.flushMessagesOnUnload===true||o.collectionType==="unload"){g(f).on("beforeunload",function(){q(false)})}if(o.loggerName){f[o.loggerName]=b;g[o.loggerName]=b}}b.initialize=j;f.WicketClientSideLogging=b;f.wicketClientSideLogging=j;function A(){if(!Array.prototype.filter){Array.prototype.filter=function(E){var D=this.length>>>0;if(typeof E!="function"){throw new TypeError()}var H=[];var G=arguments[1];for(var F=0;F<D;F++){if(F in this){var I=this[F];if(E.call(G,I,F,this)){H.push(I)}}}return H}}}}(window));
New to GrepCode? Check out our FAQ X