All Downloads are FREE. Search and download functionalities are using the official Maven repository.

templates.overview.resources.js.lib.driftwood.min.js Maven / Gradle / Ivy

Go to download

Runs multiple web applications in multiple tomcats on a single machine. Stool is a command line tool that provides a lifecycle for stages: create, configure, build, run and remove. A stage contains web applications, that may come in different flavors: Maven war projects or artifacts (GAV coordinates).

The newest version!
// **Driftwood.js** is a super simple logging and exception tracking library for client side javascript. Works in all major browsers.
//
//[Driftwood on Github](https://github.com/errplane/driftwood.js)
//
//Matthew Kanwisher [Errplane Inc](http://errplane.com)  
//MIT License
//Copyright 2012 Errplane
// Driftwood namespace is a static namespace for logging, if you want instances of loggers do:
//
//      var logger = new Driftwood.logger();
function ISODateString(a){function b(a){return a<10?"0"+a:a}return a.getUTCFullYear()+"-"+b(a.getUTCMonth()+1)+"-"+b(a.getUTCDate())+"T"+b(a.getUTCHours())+":"+b(a.getUTCMinutes())+":"+b(a.getUTCSeconds())+"Z"}function printStackTrace(a){a=a||{guess:!0};var b=a.e||null,c=!!a.guess,d=new printStackTrace.implementation,e=d.run(b);return c?d.guessAnonymousFunctions(e):e}var Driftwood=new function(){this.logger=function(){function d(a){var b=document.createElement("script");b.src=a,document.body.appendChild(b)}function e(a){var c=b.serverPath+encodeURIComponent(JSON.stringify(a));return c}function f(a){var c={application_name:b.applicationName,message:a||"",url:window.location.toString(),language:"javascript",custom_data:{hostname:window.location.hostname,user_agent:navigator.userAgent||"",referrer:document.referrer||"",cookies:document.cookie||""},backtrace:g(a),exception_class:"Javscript#Unknown"};return c}function g(a,b,c){var d=["no backtrace"];return typeof a=="object"?d=printStackTrace({e:a}):d=printStackTrace(),d}function h(a,b){var c=null;typeof a=="object"&&(c=a,a=c.message);var g=f(a,b),h=e(g);d(h)}function i(a,d,e){var f=c(d),g=new Date;f>=b.consoleLevelId&&(a[0]=d+":"+"["+ISODateString(g)+"] "+a[0]),f>=b.exceptionLevelId&&h(a[0]),e.apply(console,Array.prototype.slice.call(a))}var a=["DEBUG","INFO","ERROR","EXCEPTION","NONE"],b={consoleLevel:"DEBUG",consoleLevelId:0,exceptionLevel:"NONE",exceptionLevelId:99,mode:"development",serverPath:"/exceptions/notify?payload=",applicationName:"js_client"},c=function(b){return a.indexOf(b.toUpperCase())};return{setServerPath:function(a){b.serverPath=a},env:function(a){a.toLowerCase()=="development"?(b.consoleLevel="DEBUG",b.exceptionLevel="none",b.consoleLevelId=0,b.exceptionLevelId=4):a.toLowerCase()=="production"?(b.consoleLevel="ERROR",b.exceptionLevel="none",b.consoleLevelId=2,b.exceptionLevelId=3):console.log("Unknown environment level")},applicationName:function(a){b.applicationName=a},logLevel:function(a){var d=c(a);d>-1?(b.consoleLevel=a.toUpperCase(),b.consoleLevelId=d):console.log("Setting an invalid log level: "+a)},exceptionLevel:function(a){var d=c(a);d>-1?(b.exceptionLevel=a.toUpperCase(),b.exceptionLevelId=d):console.log("Setting an invalid log level: "+a)},debug:function(){i(arguments,"DEBUG",console.debug)},info:function(){i(arguments,"INFO",console.info)},error:function(){i(arguments,"ERROR",console.error)},exception:function(a){i(a,"EXCEPTION",console.error)}}},defaultLogger=new this.logger,this.exception=function(){defaultLogger.exception(arguments)},this.applicationName=function(a){defaultLogger.applicationName(a)},this.debug=defaultLogger.debug,this.info=defaultLogger.info,this.error=defaultLogger.error,this.env=function(a){defaultLogger.env(a)},this.setServerPath=function(a){defaultLogger.setServerPath(a)},this.exceptionLevel=function(a){defaultLogger.exceptionLevel(a)},this.logLevel=function(a){defaultLogger.logLevel(a)}};window.onerror=function(a,b,c){Driftwood.exception(a,{url:b,line:c})},Array.prototype.indexOf||(Array.prototype.indexOf=function(a){"use strict";if(this===void 0||this===null)throw new TypeError;var b=Object(this),c=b.length>>>0;if(c===0)return-1;var d=0;arguments.length>0&&(d=Number(arguments[1]),d!==d?d=0:d!==0&&d!==1/0&&d!==-Infinity&&(d=(d>0||-1)*Math.floor(Math.abs(d))));if(d>=c)return-1;var e=d>=0?d:Math.max(c-Math.abs(d),0);for(;e-1&&a.message.split("\n").length>a.stacktrace.split("\n").length?"opera9":a.stack?a.stacktrace.indexOf("called from line")<0?"opera10b":"opera11":"opera10a":"opera9":a.stack?"firefox":"other"},instrumentFunction:function(a,b,c){a=a||window;var d=a[b];a[b]=function(){return c.call(this,printStackTrace().slice(4)),a[b]._instrumented.apply(this,arguments)},a[b]._instrumented=d},deinstrumentFunction:function(a,b){a[b].constructor===Function&&a[b]._instrumented&&a[b]._instrumented.constructor===Function&&(a[b]=a[b]._instrumented)},chrome:function(a){var b=(a.stack+"\n").replace(/^\S[^\(]+?[\n$]/gm,"").replace(/^\s+(at eval )?at\s+/gm,"").replace(/^([^\(]+?)([\n$])/gm,"{anonymous}()@$1$2").replace(/^Object.\s*\(([^\)]+)\)/gm,"{anonymous}()@$1").split("\n");return b.pop(),b},firefox:function(a){return a.stack.replace(/(?:\n@:0)?\s+$/m,"").replace(/^\(/gm,"{anonymous}(").split("\n")},opera11:function(a){var b="{anonymous}",c=/^.*line (\d+), column (\d+)(?: in (.+))? in (\S+):$/,d=a.stacktrace.split("\n"),e=[];for(var f=0,g=d.length;f/,"$1").replace(//,b),e.push(j+"@"+i+" -- "+d[f+1].replace(/^\s+/,""))}}return e},opera10b:function(a){var b="{anonymous}",c=/^(.*)@(.+):(\d+)$/,d=a.stacktrace.split("\n"),e=[];for(var f=0,g=d.length;f=0&&(g=g.substr(0,j));if(g){f=g+f,i=d.exec(f);if(i&&i[1])return i[1];i=c.exec(f);if(i&&i[1])return i[1];i=e.exec(f);if(i&&i[1])return i[1]}}return"(?)"}};if(typeof console=="undefined")var console={log:function(){}};Function.prototype.bind&&console&&typeof console.log=="object"&&["log","info","warn","error","assert","dir","clear","profile","profileEnd"].forEach(function(a){console[a]=this.bind(console[a],console)},Function.prototype.call),typeof console.debug=="undefined"&&(console.debug=console.log);




© 2015 - 2024 Weber Informatics LLC | Privacy Policy