opennms
Version:
Client API for the OpenNMS network monitoring platform
1 lines • 33.4 kB
JSON
{"remainingRequest":"/data/node_modules/babel-loader/lib/index.js!/data/node_modules/typescript-logging/dist/commonjs/log/standard/LoggerFactoryService.js","dependencies":[{"path":"/data/node_modules/typescript-logging/dist/commonjs/log/standard/LoggerFactoryService.js","mtime":1553611388004},{"path":"/data/.babelrc","mtime":1553611371556},{"path":"/data/node_modules/cache-loader/dist/cjs.js","mtime":1553611387012},{"path":"/data/node_modules/babel-loader/lib/index.js","mtime":1553611386992}],"contextDependencies":[],"result":["\"use strict\";\n\nvar DataStructures_1 = require(\"../../utils/DataStructures\");\nvar LoggerOptions_1 = require(\"../LoggerOptions\");\nvar LoggerFactoryImpl_1 = require(\"./LoggerFactoryImpl\");\nvar ExtensionHelper_1 = require(\"../../extension/ExtensionHelper\");\n/**\n * Defines a LogGroupRule, this allows you to either have everything configured the same way\n * or for example loggers that start with name model. It allows you to group loggers together\n * to have a certain loglevel and other settings. You can configure this when creating the\n * LoggerFactory (which accepts multiple LogGroupRules).\n */\nvar LogGroupRule = function () {\n /**\n * Create a LogGroupRule. Basically you define what logger name(s) match for this group, what level should be used what logger type (where to log)\n * and what format to write in. If the loggerType is custom, then the callBackLogger must be supplied as callback function to return a custom logger.\n * @param regExp Regular expression, what matches for your logger names for this group\n * @param level LogLevel\n * @param logFormat LogFormat\n * @param loggerType Type of logger, if Custom, make sure to implement callBackLogger and pass in, this will be called so you can return your own logger.\n * @param callBackLogger Callback function to return a new clean custom logger (yours!)\n */\n function LogGroupRule(regExp, level, logFormat, loggerType, callBackLogger) {\n if (logFormat === void 0) {\n logFormat = new LoggerOptions_1.LogFormat();\n }\n if (loggerType === void 0) {\n loggerType = LoggerOptions_1.LoggerType.Console;\n }\n if (callBackLogger === void 0) {\n callBackLogger = null;\n }\n this._regExp = regExp;\n this._level = level;\n this._logFormat = logFormat;\n this._loggerType = loggerType;\n this._callBackLogger = callBackLogger;\n }\n Object.defineProperty(LogGroupRule.prototype, \"regExp\", {\n get: function get() {\n return this._regExp;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LogGroupRule.prototype, \"level\", {\n get: function get() {\n return this._level;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LogGroupRule.prototype, \"loggerType\", {\n get: function get() {\n return this._loggerType;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LogGroupRule.prototype, \"logFormat\", {\n get: function get() {\n return this._logFormat;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LogGroupRule.prototype, \"callBackLogger\", {\n get: function get() {\n return this._callBackLogger;\n },\n enumerable: true,\n configurable: true\n });\n return LogGroupRule;\n}();\nexports.LogGroupRule = LogGroupRule;\n/**\n * Options object you can use to configure the LoggerFactory you create at LFService.\n */\nvar LoggerFactoryOptions = function () {\n function LoggerFactoryOptions() {\n this._logGroupRules = [];\n this._enabled = true;\n }\n /**\n * Add LogGroupRule, see {LogGroupRule) for details\n * @param rule Rule to add\n * @returns {LoggerFactoryOptions} returns itself\n */\n LoggerFactoryOptions.prototype.addLogGroupRule = function (rule) {\n this._logGroupRules.push(rule);\n return this;\n };\n /**\n * Enable or disable logging completely for the LoggerFactory.\n * @param enabled True for enabled (default)\n * @returns {LoggerFactoryOptions} returns itself\n */\n LoggerFactoryOptions.prototype.setEnabled = function (enabled) {\n this._enabled = enabled;\n return this;\n };\n Object.defineProperty(LoggerFactoryOptions.prototype, \"logGroupRules\", {\n get: function get() {\n return this._logGroupRules;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LoggerFactoryOptions.prototype, \"enabled\", {\n get: function get() {\n return this._enabled;\n },\n enumerable: true,\n configurable: true\n });\n return LoggerFactoryOptions;\n}();\nexports.LoggerFactoryOptions = LoggerFactoryOptions;\n/**\n * Represents the runtime settings for a LogGroup (LogGroupRule).\n */\nvar LogGroupRuntimeSettings = function () {\n function LogGroupRuntimeSettings(logGroupRule) {\n this._logGroupRule = logGroupRule;\n this._level = logGroupRule.level;\n this._loggerType = logGroupRule.loggerType;\n this._logFormat = new LoggerOptions_1.LogFormat(new LoggerOptions_1.DateFormat(logGroupRule.logFormat.dateFormat.formatEnum, logGroupRule.logFormat.dateFormat.dateSeparator), logGroupRule.logFormat.showTimeStamp, logGroupRule.logFormat.showLoggerName);\n this._callBackLogger = logGroupRule.callBackLogger;\n }\n Object.defineProperty(LogGroupRuntimeSettings.prototype, \"logGroupRule\", {\n /**\n * Returns original LogGroupRule (so not runtime settings!)\n * @return {LogGroupRule}\n */\n get: function get() {\n return this._logGroupRule;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LogGroupRuntimeSettings.prototype, \"level\", {\n get: function get() {\n return this._level;\n },\n set: function set(value) {\n this._level = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LogGroupRuntimeSettings.prototype, \"loggerType\", {\n get: function get() {\n return this._loggerType;\n },\n set: function set(value) {\n this._loggerType = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LogGroupRuntimeSettings.prototype, \"logFormat\", {\n get: function get() {\n return this._logFormat;\n },\n set: function set(value) {\n this._logFormat = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LogGroupRuntimeSettings.prototype, \"callBackLogger\", {\n get: function get() {\n return this._callBackLogger;\n },\n set: function set(value) {\n this._callBackLogger = value;\n },\n enumerable: true,\n configurable: true\n });\n return LogGroupRuntimeSettings;\n}();\nexports.LogGroupRuntimeSettings = LogGroupRuntimeSettings;\nvar LFServiceImpl = function () {\n function LFServiceImpl() {\n this._nameCounter = 1;\n this._mapFactories = new DataStructures_1.SimpleMap();\n // Private constructor.\n ExtensionHelper_1.ExtensionHelper.register();\n }\n LFServiceImpl.getInstance = function () {\n // Loaded on demand. Do NOT change as webpack may pack things in wrong order otherwise.\n if (LFServiceImpl._INSTANCE === null) {\n LFServiceImpl._INSTANCE = new LFServiceImpl();\n }\n return LFServiceImpl._INSTANCE;\n };\n /**\n * Create a new LoggerFactory with given options (if any). If no options\n * are specified, the LoggerFactory, will accept any named logger and will\n * log on info level by default for, to the console.\n * @param options Options, optional.\n * @returns {LoggerFactory}\n */\n LFServiceImpl.prototype.createLoggerFactory = function (options) {\n if (options === void 0) {\n options = null;\n }\n var name = \"LoggerFactory\" + this._nameCounter++;\n return this.createNamedLoggerFactory(name, options);\n };\n /**\n * Create a new LoggerFactory using given name (used for console api/extension).\n * @param name Name Pick something short but distinguishable.\n * @param options Options, optional\n * @return {LoggerFactory}\n */\n LFServiceImpl.prototype.createNamedLoggerFactory = function (name, options) {\n if (options === void 0) {\n options = null;\n }\n if (this._mapFactories.exists(name)) {\n throw new Error(\"LoggerFactory with name \" + name + \" already exists.\");\n }\n var factory;\n if (options !== null) {\n factory = new LoggerFactoryImpl_1.LoggerFactoryImpl(name, options);\n } else {\n factory = new LoggerFactoryImpl_1.LoggerFactoryImpl(name, LFServiceImpl.createDefaultOptions());\n }\n this._mapFactories.put(name, factory);\n return factory;\n };\n /**\n * Closes all Loggers for LoggerFactories that were created.\n * After this call, all previously fetched Loggers (from their\n * factories) are unusable. The factories remain as they were.\n */\n LFServiceImpl.prototype.closeLoggers = function () {\n this._mapFactories.values().forEach(function (factory) {\n factory.closeLoggers();\n });\n this._mapFactories.clear();\n this._nameCounter = 1;\n };\n LFServiceImpl.prototype.getRuntimeSettingsForLoggerFactories = function () {\n var result = [];\n this._mapFactories.forEach(function (factory) {\n // Won't be null, but hey tslint ...\n if (factory != null) {\n result.push(factory);\n }\n });\n return result;\n };\n LFServiceImpl.prototype.getLogGroupSettings = function (nameLoggerFactory, idLogGroupRule) {\n var factory = this._mapFactories.get(nameLoggerFactory);\n if (factory === null) {\n return null;\n }\n return factory.getLogGroupRuntimeSettingsByIndex(idLogGroupRule);\n };\n LFServiceImpl.prototype.getLoggerFactoryRuntimeSettingsByName = function (nameLoggerFactory) {\n return this._mapFactories.get(nameLoggerFactory);\n };\n LFServiceImpl.createDefaultOptions = function () {\n return new LoggerFactoryOptions().addLogGroupRule(new LogGroupRule(new RegExp(\".+\"), LoggerOptions_1.LogLevel.Info));\n };\n return LFServiceImpl;\n}();\n// Loaded on demand. Do NOT change as webpack may pack things in wrong order otherwise.\nLFServiceImpl._INSTANCE = null;\n/**\n * Create and configure your LoggerFactory from here.\n */\nvar LFService = function () {\n function LFService() {}\n /**\n * Create a new LoggerFactory with given options (if any). If no options\n * are specified, the LoggerFactory, will accept any named logger and will\n * log on info level by default for, to the console.\n * @param options Options, optional.\n * @returns {LoggerFactory}\n */\n LFService.createLoggerFactory = function (options) {\n if (options === void 0) {\n options = null;\n }\n return LFService.INSTANCE_SERVICE.createLoggerFactory(options);\n };\n /**\n * Create a new LoggerFactory using given name (used for console api/extension).\n * @param name Name Pick something short but distinguishable.\n * @param options Options, optional\n * @return {LoggerFactory}\n */\n LFService.createNamedLoggerFactory = function (name, options) {\n if (options === void 0) {\n options = null;\n }\n return LFService.INSTANCE_SERVICE.createNamedLoggerFactory(name, options);\n };\n /**\n * Closes all Loggers for LoggerFactories that were created.\n * After this call, all previously fetched Loggers (from their\n * factories) are unusable. The factories remain as they were.\n */\n LFService.closeLoggers = function () {\n return LFService.INSTANCE_SERVICE.closeLoggers();\n };\n /**\n * Return LFServiceRuntimeSettings to retrieve information loggerfactories\n * and their runtime settings.\n * @returns {LFServiceRuntimeSettings}\n */\n LFService.getRuntimeSettings = function () {\n return LFService.INSTANCE_SERVICE;\n };\n return LFService;\n}();\nLFService.INSTANCE_SERVICE = LFServiceImpl.getInstance();\nexports.LFService = LFService;\n//# sourceMappingURL=LoggerFactoryService.js.map",{"version":3,"sources":["node_modules/typescript-logging/dist/commonjs/log/standard/LoggerFactoryService.js"],"names":["DataStructures_1","require","LoggerOptions_1","LoggerFactoryImpl_1","ExtensionHelper_1","LogGroupRule","regExp","level","logFormat","loggerType","callBackLogger","LogFormat","LoggerType","Console","_regExp","_level","_logFormat","_loggerType","_callBackLogger","Object","defineProperty","prototype","get","enumerable","configurable","exports","LoggerFactoryOptions","_logGroupRules","_enabled","addLogGroupRule","rule","push","setEnabled","enabled","LogGroupRuntimeSettings","logGroupRule","_logGroupRule","DateFormat","dateFormat","formatEnum","dateSeparator","showTimeStamp","showLoggerName","set","value","LFServiceImpl","_nameCounter","_mapFactories","SimpleMap","ExtensionHelper","register","getInstance","_INSTANCE","createLoggerFactory","options","name","createNamedLoggerFactory","exists","Error","factory","LoggerFactoryImpl","createDefaultOptions","put","closeLoggers","values","forEach","clear","getRuntimeSettingsForLoggerFactories","result","getLogGroupSettings","nameLoggerFactory","idLogGroupRule","getLogGroupRuntimeSettingsByIndex","getLoggerFactoryRuntimeSettingsByName","RegExp","LogLevel","Info","LFService","INSTANCE_SERVICE","getRuntimeSettings"],"mappings":"AAAA;;AACA,IAAIA,mBAAmBC,QAAQ,4BAAR,CAAvB;AACA,IAAIC,kBAAkBD,QAAQ,kBAAR,CAAtB;AACA,IAAIE,sBAAsBF,QAAQ,qBAAR,CAA1B;AACA,IAAIG,oBAAoBH,QAAQ,iCAAR,CAAxB;AACA;;;;;;AAMA,IAAII,eAAgB,YAAY;AAC5B;;;;;;;;;AASA,aAASA,YAAT,CAAsBC,MAAtB,EAA8BC,KAA9B,EAAqCC,SAArC,EAAgDC,UAAhD,EAA4DC,cAA5D,EAA4E;AACxE,YAAIF,cAAc,KAAK,CAAvB,EAA0B;AAAEA,wBAAY,IAAIN,gBAAgBS,SAApB,EAAZ;AAA8C;AAC1E,YAAIF,eAAe,KAAK,CAAxB,EAA2B;AAAEA,yBAAaP,gBAAgBU,UAAhB,CAA2BC,OAAxC;AAAkD;AAC/E,YAAIH,mBAAmB,KAAK,CAA5B,EAA+B;AAAEA,6BAAiB,IAAjB;AAAwB;AACzD,aAAKI,OAAL,GAAeR,MAAf;AACA,aAAKS,MAAL,GAAcR,KAAd;AACA,aAAKS,UAAL,GAAkBR,SAAlB;AACA,aAAKS,WAAL,GAAmBR,UAAnB;AACA,aAAKS,eAAL,GAAuBR,cAAvB;AACH;AACDS,WAAOC,cAAP,CAAs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,SAAd,GAA0B,IAA1B;AACA;;;AAGA,IAAIyB,YAAa,YAAY;AACzB,aAASA,SAAT,GAAqB,CACpB;AACD;;;;;;;AAOAA,cAAUxB,mBAAV,GAAgC,UAAUC,OAAV,EAAmB;AAC/C,YAAIA,YAAY,KAAK,CAArB,EAAwB;AAAEA,sBAAU,IAAV;AAAiB;AAC3C,eAAOuB,UAAUC,gBAAV,CAA2BzB,mBAA3B,CAA+CC,OAA/C,CAAP;AACH,KAHD;AAIA;;;;;;AAMAuB,cAAUrB,wBAAV,GAAqC,UAAUD,IAAV,EAAgBD,OAAhB,EAAyB;AAC1D,YAAIA,YAAY,KAAK,CAArB,EAAwB;AAAEA,sBAAU,IAAV;AAAiB;AAC3C,eAAOuB,UAAUC,gBAAV,CAA2BtB,wBAA3B,CAAoDD,IAApD,EAA0DD,OAA1D,CAAP;AACH,KAHD;AAIA;;;;;AAKAuB,cAAUd,YAAV,GAAyB,YAAY;AACjC,eAAOc,UAAUC,gBAAV,CAA2Bf,YAA3B,EAAP;AACH,KAFD;AAGA;;;;;AAKAc,cAAUE,kBAAV,GAA+B,YAAY;AACvC,eAAOF,UAAUC,gBAAjB;AACH,KAFD;AAGA,WAAOD,SAAP;AACH,CAzCgB,EAAjB;AA0CAA,UAAUC,gBAAV,GAA6BjC,cAAcM,WAAd,EAA7B;AACA1B,QAAQoD,SAAR,GAAoBA,SAApB;AACA","file":"LoggerFactoryService.js","sourceRoot":"/data","sourcesContent":["\"use strict\";\nvar DataStructures_1 = require(\"../../utils/DataStructures\");\nvar LoggerOptions_1 = require(\"../LoggerOptions\");\nvar LoggerFactoryImpl_1 = require(\"./LoggerFactoryImpl\");\nvar ExtensionHelper_1 = require(\"../../extension/ExtensionHelper\");\n/**\n * Defines a LogGroupRule, this allows you to either have everything configured the same way\n * or for example loggers that start with name model. It allows you to group loggers together\n * to have a certain loglevel and other settings. You can configure this when creating the\n * LoggerFactory (which accepts multiple LogGroupRules).\n */\nvar LogGroupRule = (function () {\n /**\n * Create a LogGroupRule. Basically you define what logger name(s) match for this group, what level should be used what logger type (where to log)\n * and what format to write in. If the loggerType is custom, then the callBackLogger must be supplied as callback function to return a custom logger.\n * @param regExp Regular expression, what matches for your logger names for this group\n * @param level LogLevel\n * @param logFormat LogFormat\n * @param loggerType Type of logger, if Custom, make sure to implement callBackLogger and pass in, this will be called so you can return your own logger.\n * @param callBackLogger Callback function to return a new clean custom logger (yours!)\n */\n function LogGroupRule(regExp, level, logFormat, loggerType, callBackLogger) {\n if (logFormat === void 0) { logFormat = new LoggerOptions_1.LogFormat(); }\n if (loggerType === void 0) { loggerType = LoggerOptions_1.LoggerType.Console; }\n if (callBackLogger === void 0) { callBackLogger = null; }\n this._regExp = regExp;\n this._level = level;\n this._logFormat = logFormat;\n this._loggerType = loggerType;\n this._callBackLogger = callBackLogger;\n }\n Object.defineProperty(LogGroupRule.prototype, \"regExp\", {\n get: function () {\n return this._regExp;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LogGroupRule.prototype, \"level\", {\n get: function () {\n return this._level;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LogGroupRule.prototype, \"loggerType\", {\n get: function () {\n return this._loggerType;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LogGroupRule.prototype, \"logFormat\", {\n get: function () {\n return this._logFormat;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LogGroupRule.prototype, \"callBackLogger\", {\n get: function () {\n return this._callBackLogger;\n },\n enumerable: true,\n configurable: true\n });\n return LogGroupRule;\n}());\nexports.LogGroupRule = LogGroupRule;\n/**\n * Options object you can use to configure the LoggerFactory you create at LFService.\n */\nvar LoggerFactoryOptions = (function () {\n function LoggerFactoryOptions() {\n this._logGroupRules = [];\n this._enabled = true;\n }\n /**\n * Add LogGroupRule, see {LogGroupRule) for details\n * @param rule Rule to add\n * @returns {LoggerFactoryOptions} returns itself\n */\n LoggerFactoryOptions.prototype.addLogGroupRule = function (rule) {\n this._logGroupRules.push(rule);\n return this;\n };\n /**\n * Enable or disable logging completely for the LoggerFactory.\n * @param enabled True for enabled (default)\n * @returns {LoggerFactoryOptions} returns itself\n */\n LoggerFactoryOptions.prototype.setEnabled = function (enabled) {\n this._enabled = enabled;\n return this;\n };\n Object.defineProperty(LoggerFactoryOptions.prototype, \"logGroupRules\", {\n get: function () {\n return this._logGroupRules;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LoggerFactoryOptions.prototype, \"enabled\", {\n get: function () {\n return this._enabled;\n },\n enumerable: true,\n configurable: true\n });\n return LoggerFactoryOptions;\n}());\nexports.LoggerFactoryOptions = LoggerFactoryOptions;\n/**\n * Represents the runtime settings for a LogGroup (LogGroupRule).\n */\nvar LogGroupRuntimeSettings = (function () {\n function LogGroupRuntimeSettings(logGroupRule) {\n this._logGroupRule = logGroupRule;\n this._level = logGroupRule.level;\n this._loggerType = logGroupRule.loggerType;\n this._logFormat = new LoggerOptions_1.LogFormat(new LoggerOptions_1.DateFormat(logGroupRule.logFormat.dateFormat.formatEnum, logGroupRule.logFormat.dateFormat.dateSeparator), logGroupRule.logFormat.showTimeStamp, logGroupRule.logFormat.showLoggerName);\n this._callBackLogger = logGroupRule.callBackLogger;\n }\n Object.defineProperty(LogGroupRuntimeSettings.prototype, \"logGroupRule\", {\n /**\n * Returns original LogGroupRule (so not runtime settings!)\n * @return {LogGroupRule}\n */\n get: function () {\n return this._logGroupRule;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LogGroupRuntimeSettings.prototype, \"level\", {\n get: function () {\n return this._level;\n },\n set: function (value) {\n this._level = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LogGroupRuntimeSettings.prototype, \"loggerType\", {\n get: function () {\n return this._loggerType;\n },\n set: function (value) {\n this._loggerType = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LogGroupRuntimeSettings.prototype, \"logFormat\", {\n get: function () {\n return this._logFormat;\n },\n set: function (value) {\n this._logFormat = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LogGroupRuntimeSettings.prototype, \"callBackLogger\", {\n get: function () {\n return this._callBackLogger;\n },\n set: function (value) {\n this._callBackLogger = value;\n },\n enumerable: true,\n configurable: true\n });\n return LogGroupRuntimeSettings;\n}());\nexports.LogGroupRuntimeSettings = LogGroupRuntimeSettings;\nvar LFServiceImpl = (function () {\n function LFServiceImpl() {\n this._nameCounter = 1;\n this._mapFactories = new DataStructures_1.SimpleMap();\n // Private constructor.\n ExtensionHelper_1.ExtensionHelper.register();\n }\n LFServiceImpl.getInstance = function () {\n // Loaded on demand. Do NOT change as webpack may pack things in wrong order otherwise.\n if (LFServiceImpl._INSTANCE === null) {\n LFServiceImpl._INSTANCE = new LFServiceImpl();\n }\n return LFServiceImpl._INSTANCE;\n };\n /**\n * Create a new LoggerFactory with given options (if any). If no options\n * are specified, the LoggerFactory, will accept any named logger and will\n * log on info level by default for, to the console.\n * @param options Options, optional.\n * @returns {LoggerFactory}\n */\n LFServiceImpl.prototype.createLoggerFactory = function (options) {\n if (options === void 0) { options = null; }\n var name = \"LoggerFactory\" + this._nameCounter++;\n return this.createNamedLoggerFactory(name, options);\n };\n /**\n * Create a new LoggerFactory using given name (used for console api/extension).\n * @param name Name Pick something short but distinguishable.\n * @param options Options, optional\n * @return {LoggerFactory}\n */\n LFServiceImpl.prototype.createNamedLoggerFactory = function (name, options) {\n if (options === void 0) { options = null; }\n if (this._mapFactories.exists(name)) {\n throw new Error(\"LoggerFactory with name \" + name + \" already exists.\");\n }\n var factory;\n if (options !== null) {\n factory = new LoggerFactoryImpl_1.LoggerFactoryImpl(name, options);\n }\n else {\n factory = new LoggerFactoryImpl_1.LoggerFactoryImpl(name, LFServiceImpl.createDefaultOptions());\n }\n this._mapFactories.put(name, factory);\n return factory;\n };\n /**\n * Closes all Loggers for LoggerFactories that were created.\n * After this call, all previously fetched Loggers (from their\n * factories) are unusable. The factories remain as they were.\n */\n LFServiceImpl.prototype.closeLoggers = function () {\n this._mapFactories.values().forEach(function (factory) {\n factory.closeLoggers();\n });\n this._mapFactories.clear();\n this._nameCounter = 1;\n };\n LFServiceImpl.prototype.getRuntimeSettingsForLoggerFactories = function () {\n var result = [];\n this._mapFactories.forEach(function (factory) {\n // Won't be null, but hey tslint ...\n if (factory != null) {\n result.push(factory);\n }\n });\n return result;\n };\n LFServiceImpl.prototype.getLogGroupSettings = function (nameLoggerFactory, idLogGroupRule) {\n var factory = this._mapFactories.get(nameLoggerFactory);\n if (factory === null) {\n return null;\n }\n return factory.getLogGroupRuntimeSettingsByIndex(idLogGroupRule);\n };\n LFServiceImpl.prototype.getLoggerFactoryRuntimeSettingsByName = function (nameLoggerFactory) {\n return this._mapFactories.get(nameLoggerFactory);\n };\n LFServiceImpl.createDefaultOptions = function () {\n return new LoggerFactoryOptions().addLogGroupRule(new LogGroupRule(new RegExp(\".+\"), LoggerOptions_1.LogLevel.Info));\n };\n return LFServiceImpl;\n}());\n// Loaded on demand. Do NOT change as webpack may pack things in wrong order otherwise.\nLFServiceImpl._INSTANCE = null;\n/**\n * Create and configure your LoggerFactory from here.\n */\nvar LFService = (function () {\n function LFService() {\n }\n /**\n * Create a new LoggerFactory with given options (if any). If no options\n * are specified, the LoggerFactory, will accept any named logger and will\n * log on info level by default for, to the console.\n * @param options Options, optional.\n * @returns {LoggerFactory}\n */\n LFService.createLoggerFactory = function (options) {\n if (options === void 0) { options = null; }\n return LFService.INSTANCE_SERVICE.createLoggerFactory(options);\n };\n /**\n * Create a new LoggerFactory using given name (used for console api/extension).\n * @param name Name Pick something short but distinguishable.\n * @param options Options, optional\n * @return {LoggerFactory}\n */\n LFService.createNamedLoggerFactory = function (name, options) {\n if (options === void 0) { options = null; }\n return LFService.INSTANCE_SERVICE.createNamedLoggerFactory(name, options);\n };\n /**\n * Closes all Loggers for LoggerFactories that were created.\n * After this call, all previously fetched Loggers (from their\n * factories) are unusable. The factories remain as they were.\n */\n LFService.closeLoggers = function () {\n return LFService.INSTANCE_SERVICE.closeLoggers();\n };\n /**\n * Return LFServiceRuntimeSettings to retrieve information loggerfactories\n * and their runtime settings.\n * @returns {LFServiceRuntimeSettings}\n */\n LFService.getRuntimeSettings = function () {\n return LFService.INSTANCE_SERVICE;\n };\n return LFService;\n}());\nLFService.INSTANCE_SERVICE = LFServiceImpl.getInstance();\nexports.LFService = LFService;\n//# sourceMappingURL=LoggerFactoryService.js.map"]}]}