forked from ajbrown/angular-loggly-logger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathangular-loggly-logger.min.js
2 lines (2 loc) · 1.6 KB
/
angular-loggly-logger.min.js
1
2
!function(a){"use strict";a.module("ngLoggly.logger",[]).provider("LogglyLogger",function(){var b=this,c=!0,d={},e=!1,f=!1,g=null,h="://logs-01.loggly.com/inputs/",i=function(b){var d=encodeURIComponent(a.toJson(b));return(c?"https":"http")+h+g+".gif?PLAINTEXT="+d};this.setExtra=function(a){return d=a,b},this.inputToken=function(c){return a.isDefined(c)?(g=c,b):g},this.useHttps=function(d){return a.isDefined(d)?(c=!!d,b):c},this.includeUrl=function(c){return a.isDefined(c)?(e=!!c,b):e},this.includeTimestamp=function(c){return a.isDefined(c)?(f=!!c,b):f},this.$get=["$injector",function(b){var c=null,h=function(h){if(g){var j=b.get("$location");c=new Date;var k=a.extend(d,h,{});e&&(k.url=j.absUrl()),f&&(k.timestamp=c.toISOString()),(new Image).src=i(k)}},j=function(){};return{lastLog:function(){return c},attach:j,sendMessage:h}}]}),a.module("ngLoggly",["ngLoggly.logger"]).config(["$provide",function(a){a.decorator("$log",["$delegate","$injector",function(a,b){var c=function(a,c,d){var e=b.get("LogglyLogger"),f=function(){var b=Array.prototype.slice.call(arguments);a.apply(null,b);var f=1==b.length?b[0]:b,g={level:c,message:f};d&&(g.logger=f),e.sendMessage(g)};return f.logs=[],f},d=function(a){return{log:a.log,info:a.info,warn:a.warn,error:a.error}}(a),e=function(a){return{log:c(d.log,"INFO",a),info:c(d.info,"INFO",a),warn:c(d.warn,"WARN",a),debug:c(d.debug,"DEBUG",a),error:c(d.error,"ERROR",a)}};return a.log=c(a.log,"INFO"),a.info=c(a.info,"INFO"),a.warn=c(a.warn,"WARN"),a.debug=c(a.debug,"DEBUG"),a.error=c(a.error,"ERROR"),a.getLogger=e,a}])}])}(window.angular);
//# sourceMappingURL=angular-loggly-logger.min.map