UNPKG

opennms

Version:

Client API for the OpenNMS network monitoring platform

1 lines 8.45 kB
{"remainingRequest":"/data/node_modules/babel-loader/lib/index.js!/data/node_modules/typescript-logging/dist/commonjs/log/category/CategoryConsoleLoggerImpl.js","dependencies":[{"path":"/data/node_modules/typescript-logging/dist/commonjs/log/category/CategoryConsoleLoggerImpl.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 LoggerOptions_1 = require(\"../LoggerOptions\");\nvar AbstractCategoryLogger_1 = require(\"./AbstractCategoryLogger\");\n/**\n * Simple logger, that logs to the console. If the console is unavailable will throw an exception.\n */\nvar CategoryConsoleLoggerImpl = function (_super) {\n __extends(CategoryConsoleLoggerImpl, _super);\n function CategoryConsoleLoggerImpl(rootCategory, runtimeSettings) {\n return _super.call(this, rootCategory, runtimeSettings) || this;\n }\n CategoryConsoleLoggerImpl.prototype.doLog = function (msg) {\n var fullMsg = this.createDefaultLogMessage(msg);\n if (console !== undefined) {\n var logged = false;\n /* tslint:disable:no-console */\n switch (msg.getLevel()) {\n case LoggerOptions_1.LogLevel.Trace:\n // Don't try trace we don't want stacks\n break;\n case LoggerOptions_1.LogLevel.Debug:\n if (console.debug) {\n console.debug(fullMsg);\n logged = true;\n }\n break;\n case LoggerOptions_1.LogLevel.Info:\n if (console.info) {\n console.info(fullMsg);\n logged = true;\n }\n break;\n case LoggerOptions_1.LogLevel.Warn:\n if (console.warn) {\n console.warn(fullMsg);\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(fullMsg);\n logged = true;\n }\n break;\n default:\n throw new Error(\"Unsupported level: \" + msg.getLevel());\n }\n if (!logged) {\n console.log(fullMsg);\n }\n } else {\n throw new Error(\"Console is not defined, cannot log msg: \" + fullMsg);\n }\n };\n return CategoryConsoleLoggerImpl;\n}(AbstractCategoryLogger_1.AbstractCategoryLogger);\nexports.CategoryConsoleLoggerImpl = CategoryConsoleLoggerImpl;\n//# sourceMappingURL=CategoryConsoleLoggerImpl.js.map",{"version":3,"sources":["node_modules/typescript-logging/dist/commonjs/log/category/CategoryConsoleLoggerImpl.js"],"names":["__extends","d","b","p","hasOwnProperty","__","constructor","prototype","Object","create","LoggerOptions_1","require","AbstractCategoryLogger_1","CategoryConsoleLoggerImpl","_super","rootCategory","runtimeSettings","call","doLog","msg","fullMsg","createDefaultLogMessage","console","undefined","logged","getLevel","LogLevel","Trace","Debug","debug","Info","info","Warn","warn","Error","Fatal","error","log","AbstractCategoryLogger","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,kBAAkBC,QAAQ,kBAAR,CAAtB;AACA,IAAIC,2BAA2BD,QAAQ,0BAAR,CAA/B;AACA;;;AAGA,IAAIE,4BAA6B,UAAUC,MAAV,EAAkB;AAC/Cd,cAAU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H;AACJ,SAtCD,MAuCK;AACD,kBAAM,IAAIc,KAAJ,CAAU,6CAA6Cd,OAAvD,CAAN;AACH;AACJ,KA5CD;AA6CA,WAAOP,yBAAP;AACH,CAnDgC,CAmD/BD,yBAAyB0B,sBAnDM,CAAjC;AAoDAC,QAAQ1B,yBAAR,GAAoCA,yBAApC;AACA","file":"CategoryConsoleLoggerImpl.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 LoggerOptions_1 = require(\"../LoggerOptions\");\nvar AbstractCategoryLogger_1 = require(\"./AbstractCategoryLogger\");\n/**\n * Simple logger, that logs to the console. If the console is unavailable will throw an exception.\n */\nvar CategoryConsoleLoggerImpl = (function (_super) {\n __extends(CategoryConsoleLoggerImpl, _super);\n function CategoryConsoleLoggerImpl(rootCategory, runtimeSettings) {\n return _super.call(this, rootCategory, runtimeSettings) || this;\n }\n CategoryConsoleLoggerImpl.prototype.doLog = function (msg) {\n var fullMsg = this.createDefaultLogMessage(msg);\n if (console !== undefined) {\n var logged = false;\n /* tslint:disable:no-console */\n switch (msg.getLevel()) {\n case LoggerOptions_1.LogLevel.Trace:\n // Don't try trace we don't want stacks\n break;\n case LoggerOptions_1.LogLevel.Debug:\n if (console.debug) {\n console.debug(fullMsg);\n logged = true;\n }\n break;\n case LoggerOptions_1.LogLevel.Info:\n if (console.info) {\n console.info(fullMsg);\n logged = true;\n }\n break;\n case LoggerOptions_1.LogLevel.Warn:\n if (console.warn) {\n console.warn(fullMsg);\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(fullMsg);\n logged = true;\n }\n break;\n default:\n throw new Error(\"Unsupported level: \" + msg.getLevel());\n }\n if (!logged) {\n console.log(fullMsg);\n }\n }\n else {\n throw new Error(\"Console is not defined, cannot log msg: \" + fullMsg);\n }\n };\n return CategoryConsoleLoggerImpl;\n}(AbstractCategoryLogger_1.AbstractCategoryLogger));\nexports.CategoryConsoleLoggerImpl = CategoryConsoleLoggerImpl;\n//# sourceMappingURL=CategoryConsoleLoggerImpl.js.map"]}]}