Start line:  
End line:  

Snippet Preview

Snippet HTML Code

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