UNPKG

opennms

Version:

Client API for the OpenNMS network monitoring platform

1 lines 8.29 kB
{"remainingRequest":"/data/node_modules/babel-loader/lib/index.js!/data/node_modules/typescript-logging/dist/commonjs/log/standard/ConsoleLoggerImpl.js","dependencies":[{"path":"/data/node_modules/typescript-logging/dist/commonjs/log/standard/ConsoleLoggerImpl.js","mtime":1553611388000},{"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 __extends = undefined && undefined.__extends || function (d, b) {\n for (var p in b) {\n if (b.hasOwnProperty(p)) d[p] = b[p];\n }function __() {\n this.constructor = d;\n }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar AbstractLogger_1 = require(\"./AbstractLogger\");\nvar LoggerOptions_1 = require(\"../LoggerOptions\");\n/**\n * Simple logger, that logs to the console. If the console is unavailable will throw exception.\n */\nvar ConsoleLoggerImpl = function (_super) {\n __extends(ConsoleLoggerImpl, _super);\n function ConsoleLoggerImpl(name, logGroupRuntimeSettings) {\n return _super.call(this, name, logGroupRuntimeSettings) || this;\n }\n ConsoleLoggerImpl.prototype.doLog = function (message) {\n if (console !== undefined) {\n var logged = false;\n var logLevel = message.level;\n var msg = this.createDefaultLogMessage(message);\n /* tslint:disable:no-console */\n switch (logLevel) {\n case LoggerOptions_1.LogLevel.Trace:\n // Do not try trace we don't want a stack\n break;\n case LoggerOptions_1.LogLevel.Debug:\n if (console.debug) {\n console.debug(msg);\n logged = true;\n }\n break;\n case LoggerOptions_1.LogLevel.Info:\n if (console.info) {\n console.info(msg);\n logged = true;\n }\n break;\n case LoggerOptions_1.LogLevel.Warn:\n if (console.warn) {\n console.warn(msg);\n logged = true;\n }\n break;\n case LoggerOptions_1.LogLevel.Error:\n case LoggerOptions_1.LogLevel.Fatal:\n if (console.error) {\n console.error(msg);\n logged = true;\n }\n break;\n default:\n throw new Error(\"Log level not supported: \" + logLevel);\n }\n if (!logged) {\n console.log(msg);\n }\n } else {\n throw new Error(\"Console is not defined, cannot log msg: \" + message.message);\n }\n };\n return ConsoleLoggerImpl;\n}(AbstractLogger_1.AbstractLogger);\nexports.ConsoleLoggerImpl = ConsoleLoggerImpl;\n//# sourceMappingURL=ConsoleLoggerImpl.js.map",{"version":3,"sources":["node_modules/typescript-logging/dist/commonjs/log/standard/ConsoleLoggerImpl.js"],"names":["__extends","d","b","p","hasOwnProperty","__","constructor","prototype","Object","create","AbstractLogger_1","require","LoggerOptions_1","ConsoleLoggerImpl","_super","name","logGroupRuntimeSettings","call","doLog","message","console","undefined","logged","logLevel","level","msg","createDefaultLogMessage","LogLevel","Trace","Debug","debug","Info","info","Warn","warn","Error","Fatal","error","log","AbstractLogger","exports"],"mappings":"AAAA;;AACA,IAAIA,YAAa,aAAQ,UAAKA,SAAd,IAA4B,UAAUC,CAAV,EAAaC,CAAb,EAAgB;AACxD,SAAK,IAAIC,CAAT,IAAcD,CAAd;AAAiB,YAAIA,EAAEE,cAAF,CAAiBD,CAAjB,CAAJ,EAAyBF,EAAEE,CAAF,IAAOD,EAAEC,CAAF,CAAP;AAA1C,KACA,SAASE,EAAT,GAAc;AAAE,aAAKC,WAAL,GAAmBL,CAAnB;AAAuB;AACvCA,MAAEM,SAAF,GAAcL,MAAM,IAAN,GAAaM,OAAOC,MAAP,CAAcP,CAAd,CAAb,IAAiCG,GAAGE,SAAH,GAAeL,EAAEK,SAAjB,EAA4B,IAAIF,EAAJ,EAA7D,CAAd;AACH,CAJD;AAKA,IAAIK,mBAAmBC,QAAQ,kBAAR,CAAvB;AACA,IAAIC,kBAAkBD,QAAQ,kBAAR,CAAtB;AACA;;;AAGA,IAAIE,oBAAqB,UAAUC,MAAV,EAAkB;AACvCd,cAAUa,iBAAV,EAA6BC,MAA7B;AACA,aAASD,iBAAT,CAA2BE,IAA3B,EAAiCC,uBAAjC,EAA0D;AACtD,eA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A/D,CAAN;AACH;AACJ,KA7CD;AA8CA,WAAON,iBAAP;AACH,CApDwB,CAoDvBH,iBAAiB6B,cApDM,CAAzB;AAqDAC,QAAQ3B,iBAAR,GAA4BA,iBAA5B;AACA","file":"ConsoleLoggerImpl.js","sourceRoot":"/data","sourcesContent":["\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar AbstractLogger_1 = require(\"./AbstractLogger\");\nvar LoggerOptions_1 = require(\"../LoggerOptions\");\n/**\n * Simple logger, that logs to the console. If the console is unavailable will throw exception.\n */\nvar ConsoleLoggerImpl = (function (_super) {\n __extends(ConsoleLoggerImpl, _super);\n function ConsoleLoggerImpl(name, logGroupRuntimeSettings) {\n return _super.call(this, name, logGroupRuntimeSettings) || this;\n }\n ConsoleLoggerImpl.prototype.doLog = function (message) {\n if (console !== undefined) {\n var logged = false;\n var logLevel = message.level;\n var msg = this.createDefaultLogMessage(message);\n /* tslint:disable:no-console */\n switch (logLevel) {\n case LoggerOptions_1.LogLevel.Trace:\n // Do not try trace we don't want a stack\n break;\n case LoggerOptions_1.LogLevel.Debug:\n if (console.debug) {\n console.debug(msg);\n logged = true;\n }\n break;\n case LoggerOptions_1.LogLevel.Info:\n if (console.info) {\n console.info(msg);\n logged = true;\n }\n break;\n case LoggerOptions_1.LogLevel.Warn:\n if (console.warn) {\n console.warn(msg);\n logged = true;\n }\n break;\n case LoggerOptions_1.LogLevel.Error:\n case LoggerOptions_1.LogLevel.Fatal:\n if (console.error) {\n console.error(msg);\n logged = true;\n }\n break;\n default:\n throw new Error(\"Log level not supported: \" + logLevel);\n }\n if (!logged) {\n console.log(msg);\n }\n }\n else {\n throw new Error(\"Console is not defined, cannot log msg: \" + message.message);\n }\n };\n return ConsoleLoggerImpl;\n}(AbstractLogger_1.AbstractLogger));\nexports.ConsoleLoggerImpl = ConsoleLoggerImpl;\n//# sourceMappingURL=ConsoleLoggerImpl.js.map"]}]}