-
Notifications
You must be signed in to change notification settings - Fork 0
/
cat-log4angular.min.js.map
1 lines (1 loc) · 15.7 KB
/
cat-log4angular.min.js.map
1
{"version":3,"sources":["src/js-header.js.tpl","src/cat-log-service.js","src/cat-http-appender.js","src/js-footer.js.tpl"],"names":["window","catLog4Angular","angular","CatLogServiceProvider","ROOT_LOGGER_NAME","DEFAULT_LEVEL","LOG_LEVEL_ORDER","providerSelf","this","config","dumpMemorySizes","appenderList","configureLogLevel","group","level","undefined","Error","configure","appender","push","enableMemorySizes","disableMemorySizes","$get","rootLogger","parent","resolveLevel","setLevel","newLevel","isDefined","loggify","logger","forEach","methodLvlNumber","log","message","memorySizes","performance","memory","report","func","start","Date","getTime","elapsed","Logger","isUndefined","CatHttpLogAppender","$http","$interval","$log","HTTP_LOGGER_NAME","postUrl","logs","toString","timestamp","flush","minLevelOrder","minLevel","logsToSend","logEntry","length","post","success","debug","error","data","status","headers","statusText","intervalInSeconds","CatHttpLogAppenderProvider","interval","_intervalInSeconds","_postUrl","minUploadLevel","_minLevel","setConfig","key","value","module","constant","info","warn","console","stack","provider","$provide","decorator","$delegate","catLogService","require","define"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;CAuBA,SAAAA,QACA,YAEA,SAAAC,gBAAAC,SCRA,QAAAC,uBAAAC,iBAAAC,cAAAC,iBAEA,GAAAC,cAAAC,KACAC,SACAA,QAAAL,kBAAAC,aACA,IAAAK,kBAAA,EAEAC,gBAEAC,kBAAA,SAAAC,MAAAC,OACA,GAAAD,QAAAT,kBAAAW,SAAAD,MACA,KAAA,IAAAE,OAAA,oDAGA,OADAP,QAAAI,OAAAC,MACAN,KAGAA,MAAAS,UAAAL,kBACAJ,KAAAU,SAAA,SAAAA,UAEA,MADAP,cAAAQ,KAAAD,UACAV,MAEAA,KAAAY,kBAAA,WAEA,MADAV,kBAAA,EACAF,MAEAA,KAAAa,mBAAA,WAEA,MADAX,kBAAA,EACAF,MAGAA,KAAAc,KAAA,WACA,GAAAC,aACAC,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C,UAAAC,KAAAxC,OAAAyC,iBAAA5C,mBCjFA,MFkIAJ,SACA6E,OAAA,sBACAC,SAAA,mBAAA,QACAA,SAAA,gBAAA,QACAA,SAAA,mBAAAjB,MAAA,EAAAkB,KAAA,EAAAC,KAAA,EAAAlB,MAAA,IACAgB,SAAA,oBACA1C,OAAA,SAAAxB,MAAAD,MAAAqB,SACA,gBAAAiD,WACAjD,kBAAAlB,QACAmE,QAAArE,OAAAD,MAAA,IAAAqB,QAAAA,SACAiD,QAAAlD,IAAAC,QAAAkD,QAEAD,QAAArE,OAAAD,MAAA,IAAAqB,aAKAmD,SAAA,iBAAA,mBAAA,gBAAA,kBAAAlF,wBACAM,QAAA,WAAA,SAAA6E,UACAA,SAAAC,UAAA,QAAA,YAAA,gBAAA,mBAAA,SAAAC,UAAAC,cAAArF,kBAEA,GAAAmB,YAAAkE,cAAA7C,QASA,OAPA1C,SAAA6B,SAAA,QAAA,OAAA,OAAA,SAAA,SAAAjB,OACA0E,UAAA1E,OAAAS,WAAAT,SAEA0E,UAAA5C,OAAA6C,cAAA7C,OACA4C,UAAA9D,SAAAH,WAAAG,SACA8D,UAAA3E,MAAAT,iBAEAoF,gBC3EAtF,QACA6E,OAAA,mBACAC,SAAA,mBAAA,sBACAK,SAAA,sBAAAf,6BCxFA,kBAGAtE,OAAA0F,SAAA1F,OAAA2F,OACA3F,OAAA2F,QAAA,WAAA1F,gBAEAA,eAAAD,OAAAE,UAEAF","file":"cat-log4angular.min.js","sourcesContent":["/*!\r\n The MIT License (MIT)\r\n\r\n Copyright (c) 2014-2015 Catalysts\r\n\r\n Permission is hereby granted, free of charge, to any person obtaining a copy\r\n of this software and associated documentation files (the \"Software\"), to deal\r\n in the Software without restriction, including without limitation the rights\r\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n copies of the Software, and to permit persons to whom the Software is\r\n furnished to do so, subject to the following conditions:\r\n\r\n The above copyright notice and this permission notice shall be included in all\r\n copies or substantial portions of the Software.\r\n\r\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n SOFTWARE.\r\n */\r\n(function (window) {\r\n 'use strict';\r\n\r\n function catLog4Angular(angular) {","'use strict';\r\n\r\n/*\r\n * EcmaScript5 compatible logging based on ideas from Diary.js\r\n * see https://docs.google.com/document/d/1gGUEODxxDjY7azF8InqtN1pRcLo3WhGb8BcoIihyI80/edit#heading=h.w7kphvm7blel\r\n *\r\n * More details:\r\n * https://github.com/angular/diary.js/blob/master/src/diary.js\r\n * http://log4javascript.org/\r\n *\r\n *\r\n * Appender interface:\r\n * {\r\n * report(level, group, message [, memorySizes]) : function called by the logger, if the configured log level is met\r\n * }\r\n */\r\n\r\n\r\nfunction CatLogServiceProvider(ROOT_LOGGER_NAME, DEFAULT_LEVEL, LOG_LEVEL_ORDER) {\r\n // available levels: log, debug, info, warn, error\r\n var providerSelf = this;\r\n var config = {};\r\n config[ROOT_LOGGER_NAME] = DEFAULT_LEVEL;\r\n var dumpMemorySizes = false;\r\n\r\n var appenderList = [];\r\n\r\n var configureLogLevel = function (group, level) {\r\n if (group === ROOT_LOGGER_NAME && level === undefined) {\r\n throw new Error('Cannot undefine the log level of the root logger.');\r\n }\r\n config[group] = level;\r\n return this;\r\n };\r\n\r\n this.configure = configureLogLevel;\r\n this.appender = function (appender) {\r\n appenderList.push(appender);\r\n return this;\r\n };\r\n this.enableMemorySizes = function () {\r\n dumpMemorySizes = true;\r\n return this;\r\n };\r\n this.disableMemorySizes = function () {\r\n dumpMemorySizes = false;\r\n return this;\r\n };\r\n\r\n this.$get = function () {\r\n var rootLogger = {\r\n parent: undefined,\r\n group: ROOT_LOGGER_NAME,\r\n resolveLevel: function () {\r\n return config[ROOT_LOGGER_NAME];\r\n },\r\n setLevel: function (newLevel) {\r\n configureLogLevel(this.group, newLevel);\r\n }\r\n };\r\n /*\r\n Resolves the log level for the current logger, by travelling up the hierarchy\r\n if no log level is defined for the current logger.\r\n This method could be memoized.\r\n */\r\n var resolveLevel = function () {\r\n if (angular.isDefined(config[this.group])) {\r\n // log level is defined, use it\r\n return config[this.group];\r\n } else if (angular.isDefined(this.parent)) {\r\n return this.parent.resolveLevel();\r\n } else {\r\n throw new Error('Neither log level nor parent set for this logger: \"' + this.group + '\".');\r\n }\r\n };\r\n var loggify = function (logger) {\r\n angular.forEach(['debug', 'info', 'warn', 'error'], function (level) {\r\n var methodLvlNumber = LOG_LEVEL_ORDER[level];\r\n var log = function (message) {\r\n if (LOG_LEVEL_ORDER[logger.resolveLevel()] <= methodLvlNumber) {\r\n angular.forEach(appenderList, function (appender) {\r\n var memorySizes;\r\n if (dumpMemorySizes && window.performance && window.performance.memory) {\r\n memorySizes = window.performance.memory;\r\n }\r\n appender.report(level, logger.group, message, memorySizes);\r\n });\r\n }\r\n };\r\n logger[level] = function (message, func) {\r\n if (typeof func === 'undefined') {\r\n log(message);\r\n } else {\r\n // performance measurement\r\n var start = new Date().getTime();\r\n log('BEFORE: ' + message);\r\n func();\r\n var elapsed = new Date().getTime() - start;\r\n log('AFTER: ' + message + ' took ' + elapsed + ' ms');\r\n }\r\n };\r\n });\r\n };\r\n loggify(rootLogger);\r\n return {\r\n Logger: function (group, parent) {\r\n if (angular.isUndefined(group)) {\r\n return rootLogger;\r\n }\r\n if (angular.isUndefined(parent)) {\r\n // use root logger as default parent\r\n parent = rootLogger;\r\n }\r\n // possibility to memoize the logger object\r\n var logger = {\r\n parent: parent,\r\n group: group,\r\n resolveLevel: resolveLevel,\r\n setLevel: function (newLevel) {\r\n configureLogLevel(this.group, newLevel);\r\n }\r\n };\r\n loggify(logger);\r\n return logger;\r\n },\r\n appender: providerSelf.appender\r\n };\r\n };\r\n}\r\n\r\nangular\r\n .module('cat.service.log', [])\r\n .constant('ROOT_LOGGER_NAME', 'ROOT')\r\n .constant('DEFAULT_LEVEL', 'info')\r\n .constant('LOG_LEVEL_ORDER', {'debug': 1, 'info': 2, 'warn': 3, 'error': 4})\r\n .constant('CONSOLE_APPENDER', {\r\n report: function (level, group, message) {\r\n if (typeof console === 'object') {\r\n if (message instanceof Error) {\r\n console[level](group + ' ' + message.message);\r\n console.log(message.stack);\r\n } else {\r\n console[level](group + ' ' + message);\r\n }\r\n }\r\n }\r\n })\r\n .provider('catLogService', ['ROOT_LOGGER_NAME', 'DEFAULT_LEVEL', 'LOG_LEVEL_ORDER', CatLogServiceProvider])\r\n .config(['$provide', function ($provide) {\r\n $provide.decorator('$log', ['$delegate', 'catLogService', 'ROOT_LOGGER_NAME', function ($delegate, catLogService, ROOT_LOGGER_NAME) {\r\n // instantiate root logger\r\n var rootLogger = catLogService.Logger();\r\n\r\n angular.forEach(['debug', 'info', 'warn', 'error'], function (level) {\r\n $delegate[level] = rootLogger[level];\r\n });\r\n $delegate.Logger = catLogService.Logger;\r\n $delegate.setLevel = rootLogger.setLevel;\r\n $delegate.group = ROOT_LOGGER_NAME;\r\n\r\n return $delegate;\r\n }]);\r\n }]);\r\n","'use strict';\r\n\r\n/*\r\n * HTTP Upload Appender for ngLogCustom module\r\n *\r\n * Uploads the logs that have a log level >= minLevel to postUrl in the specified interval.\r\n * No uploads happen if no suitable logs have been produced.\r\n */\r\nfunction CatHttpLogAppender($http,\r\n $interval,\r\n $log,\r\n config,\r\n HTTP_LOGGER_NAME,\r\n LOG_LEVEL_ORDER) {\r\n var logger = $log.Logger(HTTP_LOGGER_NAME);\r\n if (typeof config.postUrl === 'undefined') {\r\n throw new Error('catHttpLogAppenderProvider requires definition of postUrl');\r\n }\r\n var logs = [];\r\n\r\n this.report = function (level, group, message, memorySizes) {\r\n logs.push({\r\n level: level,\r\n group: group,\r\n message: typeof message === 'string' ? message : message.toString(),\r\n memorySizes: memorySizes,\r\n timestamp: new Date().getTime()\r\n });\r\n };\r\n this.flush = function () {\r\n var minLevelOrder = LOG_LEVEL_ORDER[config.minLevel];\r\n var logsToSend = [];\r\n angular.forEach(logs, function (logEntry) {\r\n if (LOG_LEVEL_ORDER[logEntry.level] >= minLevelOrder) {\r\n logsToSend.push(logEntry);\r\n }\r\n });\r\n logs.length = 0;\r\n if (logsToSend.length > 0) {\r\n return $http.post(config.postUrl, logsToSend, config)\r\n .success(function () {\r\n logger.debug('Successfully uploaded logs.');\r\n })\r\n .error(function (data, status, headers, config, statusText) {\r\n logger.debug('Error uploading logs: ' + status + ' ' + statusText);\r\n });\r\n } else {\r\n logger.debug('No logs to upload - skipping upload request.');\r\n }\r\n };\r\n $interval(this.flush, config.intervalInSeconds * 1000, 0, false);\r\n}\r\n\r\n\r\nfunction CatHttpLogAppenderProvider() {\r\n var intervalInSeconds = 10;\r\n var postUrl;\r\n var minLevel = 'info';\r\n var config = {};\r\n this.interval = function (_intervalInSeconds) {\r\n intervalInSeconds = _intervalInSeconds;\r\n return this;\r\n };\r\n this.postUrl = function (_postUrl) {\r\n postUrl = _postUrl;\r\n return this;\r\n };\r\n this.minUploadLevel = function (_minLevel) {\r\n minLevel = _minLevel;\r\n return this;\r\n };\r\n this.setConfig = function(key, value) {\r\n config[key] = value;\r\n return this;\r\n };\r\n\r\n this.$get = ['$http', '$interval', '$log', 'HTTP_LOGGER_NAME', 'LOG_LEVEL_ORDER',\r\n function ($http, $interval, $log, HTTP_LOGGER_NAME, LOG_LEVEL_ORDER) {\r\n config.intervalInSeconds = intervalInSeconds;\r\n config.postUrl = postUrl;\r\n config.minLevel = minLevel;\r\n return new CatHttpLogAppender($http, $interval, $log, config, HTTP_LOGGER_NAME, LOG_LEVEL_ORDER);\r\n }];\r\n}\r\n\r\nangular\r\n .module('cat.service.log')\r\n .constant('HTTP_LOGGER_NAME', 'catHttpLogAppender')\r\n .provider('catHttpLogAppender', [CatHttpLogAppenderProvider]);\r\n"," return 'cat.service.log';\r\n }\r\n\r\n if (!!window.require && !!window.define) {\r\n window.define(['angular'], catLog4Angular);\r\n } else {\r\n catLog4Angular(window.angular);\r\n }\r\n})(window);"],"sourceRoot":"../src"}