UNPKG

opennms

Version:

Client API for the OpenNMS network monitoring platform

1 lines 28.9 kB
{"remainingRequest":"/data/node_modules/babel-loader/lib/index.js!/data/node_modules/typescript-logging/dist/commonjs/log/standard/AbstractLogger.js","dependencies":[{"path":"/data/node_modules/typescript-logging/dist/commonjs/log/standard/AbstractLogger.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 LoggerOptions_1 = require(\"../LoggerOptions\");\nvar DataStructures_1 = require(\"../../utils/DataStructures\");\nvar MessageUtils_1 = require(\"../../utils/MessageUtils\");\nvar LogMessageInternalImpl = function () {\n function LogMessageInternalImpl(loggerName, message, errorAsStack, error, logGroupRule, date, level, ready) {\n this._errorAsStack = null;\n this._error = null;\n this._loggerName = loggerName;\n this._message = message;\n this._errorAsStack = errorAsStack;\n this._error = error;\n this._logGroupRule = logGroupRule;\n this._date = date;\n this._level = level;\n this._ready = ready;\n }\n Object.defineProperty(LogMessageInternalImpl.prototype, \"loggerName\", {\n get: function get() {\n return this._loggerName;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LogMessageInternalImpl.prototype, \"message\", {\n get: function get() {\n return this._message;\n },\n set: function set(value) {\n this._message = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LogMessageInternalImpl.prototype, \"errorAsStack\", {\n get: function get() {\n return this._errorAsStack;\n },\n set: function set(value) {\n this._errorAsStack = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LogMessageInternalImpl.prototype, \"error\", {\n get: function get() {\n return this._error;\n },\n set: function set(value) {\n this._error = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LogMessageInternalImpl.prototype, \"logGroupRule\", {\n get: function get() {\n return this._logGroupRule;\n },\n set: function set(value) {\n this._logGroupRule = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LogMessageInternalImpl.prototype, \"date\", {\n get: function get() {\n return this._date;\n },\n set: function set(value) {\n this._date = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LogMessageInternalImpl.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(LogMessageInternalImpl.prototype, \"ready\", {\n get: function get() {\n return this._ready;\n },\n set: function set(value) {\n this._ready = value;\n },\n enumerable: true,\n configurable: true\n });\n return LogMessageInternalImpl;\n}();\n/**\n * Abstract base logger, extend to easily implement a custom logger that\n * logs wherever you want. You only need to implement doLog(msg: LogMessage) and\n * log that somewhere (it will contain format and everything else).\n */\nvar AbstractLogger = function () {\n function AbstractLogger(name, logGroupRuntimeSettings) {\n this._allMessages = new DataStructures_1.LinkedList();\n this._open = true;\n this._name = name;\n this._logGroupRuntimeSettings = logGroupRuntimeSettings;\n }\n Object.defineProperty(AbstractLogger.prototype, \"name\", {\n get: function get() {\n return this._name;\n },\n enumerable: true,\n configurable: true\n });\n AbstractLogger.prototype.trace = function (msg, error) {\n if (error === void 0) {\n error = null;\n }\n this._log(LoggerOptions_1.LogLevel.Trace, msg, error);\n };\n AbstractLogger.prototype.debug = function (msg, error) {\n if (error === void 0) {\n error = null;\n }\n this._log(LoggerOptions_1.LogLevel.Debug, msg, error);\n };\n AbstractLogger.prototype.info = function (msg, error) {\n if (error === void 0) {\n error = null;\n }\n this._log(LoggerOptions_1.LogLevel.Info, msg, error);\n };\n AbstractLogger.prototype.warn = function (msg, error) {\n if (error === void 0) {\n error = null;\n }\n this._log(LoggerOptions_1.LogLevel.Warn, msg, error);\n };\n AbstractLogger.prototype.error = function (msg, error) {\n if (error === void 0) {\n error = null;\n }\n this._log(LoggerOptions_1.LogLevel.Error, msg, error);\n };\n AbstractLogger.prototype.fatal = function (msg, error) {\n if (error === void 0) {\n error = null;\n }\n this._log(LoggerOptions_1.LogLevel.Fatal, msg, error);\n };\n AbstractLogger.prototype.tracec = function (msg, error) {\n this._logc(LoggerOptions_1.LogLevel.Trace, msg, error);\n };\n AbstractLogger.prototype.debugc = function (msg, error) {\n this._logc(LoggerOptions_1.LogLevel.Debug, msg, error);\n };\n AbstractLogger.prototype.infoc = function (msg, error) {\n this._logc(LoggerOptions_1.LogLevel.Info, msg, error);\n };\n AbstractLogger.prototype.warnc = function (msg, error) {\n this._logc(LoggerOptions_1.LogLevel.Warn, msg, error);\n };\n AbstractLogger.prototype.errorc = function (msg, error) {\n this._logc(LoggerOptions_1.LogLevel.Error, msg, error);\n };\n AbstractLogger.prototype.fatalc = function (msg, error) {\n this._logc(LoggerOptions_1.LogLevel.Fatal, msg, error);\n };\n AbstractLogger.prototype.isTraceEnabled = function () {\n return this._logGroupRuntimeSettings.level === LoggerOptions_1.LogLevel.Trace;\n };\n AbstractLogger.prototype.isDebugEnabled = function () {\n return this._logGroupRuntimeSettings.level <= LoggerOptions_1.LogLevel.Debug;\n };\n AbstractLogger.prototype.isInfoEnabled = function () {\n return this._logGroupRuntimeSettings.level <= LoggerOptions_1.LogLevel.Info;\n };\n AbstractLogger.prototype.isWarnEnabled = function () {\n return this._logGroupRuntimeSettings.level <= LoggerOptions_1.LogLevel.Warn;\n };\n AbstractLogger.prototype.isErrorEnabled = function () {\n return this._logGroupRuntimeSettings.level <= LoggerOptions_1.LogLevel.Error;\n };\n AbstractLogger.prototype.isFatalEnabled = function () {\n return this._logGroupRuntimeSettings.level <= LoggerOptions_1.LogLevel.Fatal;\n };\n AbstractLogger.prototype.getLogLevel = function () {\n return this._logGroupRuntimeSettings.level;\n };\n AbstractLogger.prototype.isOpen = function () {\n return this._open;\n };\n AbstractLogger.prototype.close = function () {\n this._open = false;\n this._allMessages.clear();\n };\n AbstractLogger.prototype.createDefaultLogMessage = function (msg) {\n return MessageUtils_1.MessageFormatUtils.renderDefaultLog4jMessage(msg, true);\n };\n AbstractLogger.prototype._log = function (level, msg, error) {\n if (error === void 0) {\n error = null;\n }\n if (this._open && this._logGroupRuntimeSettings.level <= level) {\n this._allMessages.addTail(this.createMessage(level, msg, new Date(), error));\n this.processMessages();\n }\n };\n AbstractLogger.prototype._logc = function (level, msg, error) {\n if (this._open && this._logGroupRuntimeSettings.level <= level) {\n this._allMessages.addTail(this.createMessage(level, msg(), new Date(), error !== undefined && error !== null ? error() : null));\n this.processMessages();\n }\n };\n AbstractLogger.prototype.createMessage = function (level, msg, date, error) {\n var _this = this;\n if (error === void 0) {\n error = null;\n }\n if (error !== null) {\n var message_1 = new LogMessageInternalImpl(this._name, msg, null, error, this._logGroupRuntimeSettings.logGroupRule, date, level, false);\n MessageUtils_1.MessageFormatUtils.renderError(error).then(function (stack) {\n message_1.errorAsStack = stack;\n message_1.ready = true;\n _this.processMessages();\n });\n return message_1;\n }\n return new LogMessageInternalImpl(this._name, msg, null, error, this._logGroupRuntimeSettings.logGroupRule, date, level, true);\n };\n AbstractLogger.prototype.processMessages = function () {\n // Basically we wait until errors are resolved (those messages\n // may not be ready).\n var msgs = this._allMessages;\n if (msgs.getSize() > 0) {\n do {\n var msg = msgs.getHead();\n if (msg != null) {\n if (!msg.ready) {\n break;\n }\n msgs.removeHead();\n // This can never be null normally, but strict null checking ...\n if (msg.message !== null) {\n this.doLog(msg);\n }\n }\n } while (msgs.getSize() > 0);\n }\n };\n return AbstractLogger;\n}();\nexports.AbstractLogger = AbstractLogger;\n//# sourceMappingURL=AbstractLogger.js.map",{"version":3,"sources":["node_modules/typescript-logging/dist/commonjs/log/standard/AbstractLogger.js"],"names":["LoggerOptions_1","require","DataStructures_1","MessageUtils_1","LogMessageInternalImpl","loggerName","message","errorAsStack","error","logGroupRule","date","level","ready","_errorAsStack","_error","_loggerName","_message","_logGroupRule","_date","_level","_ready","Object","defineProperty","prototype","get","enumerable","configurable","set","value","AbstractLogger","name","logGroupRuntimeSettings","_allMessages","LinkedList","_open","_name","_logGroupRuntimeSettings","trace","msg","_log","LogLevel","Trace","debug","Debug","info","Info","warn","Warn","Error","fatal","Fatal","tracec","_logc","debugc","infoc","warnc","errorc","fatalc","isTraceEnabled","isDebugEnabled","isInfoEnabled","isWarnEnabled","isErrorEnabled","isFatalEnabled","getLogLevel","isOpen","close","clear","createDefaultLogMessage","MessageFormatUtils","renderDefaultLog4jMessage","addTail","createMessage","Date","processMessages","undefined","_this","message_1","renderError","then","stack","msgs","getSize","getHead","removeHead","doLog","exports"],"mappings":"AAAA;;AACA,IAAIA,kBAAkBC,QAAQ,kBAAR,CAAtB;AACA,IAAIC,mBAAmBD,QAAQ,4BAAR,CAAvB;AACA,IAAIE,iBAAiBF,QAAQ,0BAAR,CAArB;AACA,IAAIG,yBAA0B,YAAY;AACtC,aAASA,sBAAT,CAAgCC,UAAhC,EAA4CC,OAA5C,EAAqDC,YAArD,EAAmEC,KAAnE,EAA0EC,YAA1E,EAAwFC,IAAxF,EAA8FC,KAA9F,EAAqGC,KAArG,EAA4G;AACxG,aAAKC,aAAL,GAAqB,IAArB;AACA,aAAKC,MAAL,GAAc,IAAd;AACA,aAAKC,WAAL,GAAmBV,UAAnB;AACA,aAAKW,QAAL,GAAgBV,OAAhB;AACA,aAAKO,aAAL,GAAqBN,YAArB;AACA,aAAKO,MAAL,GAAcN,KAAd;AACA,aAAKS,aAAL,GAAqBR,YAArB;AACA,aAAKS,KAAL,GAAaR,IAAb;AACA,aAAKS,MAAL,GAAcR,KAAd;AACA,aAAKS,MAAL,GAAcR,KAAd;AACH;AACDS,WAAOC,cAAP,CAAsBlB,uBAAuBmB,SAA7C,EAAwD,YAAxD,EAAsE;AAClEC,aAAK,eAAY;AACb,mBAAO,KAAKT,WAAZ;AACH,SAHiE;AAIlEU,oBAAY,IAJsD;AAKlEC,sBAAc;AALoD,KAAtE;AAOAL,WAAOC,cAAP,CAAsBlB,uBAAuBmB,SAA7C,EAAwD,SAAxD,EAAmE;AAC/DC,aAAK,eAAY;AACb,mBAAO,KAAKR,QAAZ;AACH,SAH8D;AAI/DW,a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ar DataStructures_1 = require(\"../../utils/DataStructures\");\nvar MessageUtils_1 = require(\"../../utils/MessageUtils\");\nvar LogMessageInternalImpl = (function () {\n function LogMessageInternalImpl(loggerName, message, errorAsStack, error, logGroupRule, date, level, ready) {\n this._errorAsStack = null;\n this._error = null;\n this._loggerName = loggerName;\n this._message = message;\n this._errorAsStack = errorAsStack;\n this._error = error;\n this._logGroupRule = logGroupRule;\n this._date = date;\n this._level = level;\n this._ready = ready;\n }\n Object.defineProperty(LogMessageInternalImpl.prototype, \"loggerName\", {\n get: function () {\n return this._loggerName;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LogMessageInternalImpl.prototype, \"message\", {\n get: function () {\n return this._message;\n },\n set: function (value) {\n this._message = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LogMessageInternalImpl.prototype, \"errorAsStack\", {\n get: function () {\n return this._errorAsStack;\n },\n set: function (value) {\n this._errorAsStack = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LogMessageInternalImpl.prototype, \"error\", {\n get: function () {\n return this._error;\n },\n set: function (value) {\n this._error = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LogMessageInternalImpl.prototype, \"logGroupRule\", {\n get: function () {\n return this._logGroupRule;\n },\n set: function (value) {\n this._logGroupRule = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LogMessageInternalImpl.prototype, \"date\", {\n get: function () {\n return this._date;\n },\n set: function (value) {\n this._date = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LogMessageInternalImpl.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(LogMessageInternalImpl.prototype, \"ready\", {\n get: function () {\n return this._ready;\n },\n set: function (value) {\n this._ready = value;\n },\n enumerable: true,\n configurable: true\n });\n return LogMessageInternalImpl;\n}());\n/**\n * Abstract base logger, extend to easily implement a custom logger that\n * logs wherever you want. You only need to implement doLog(msg: LogMessage) and\n * log that somewhere (it will contain format and everything else).\n */\nvar AbstractLogger = (function () {\n function AbstractLogger(name, logGroupRuntimeSettings) {\n this._allMessages = new DataStructures_1.LinkedList();\n this._open = true;\n this._name = name;\n this._logGroupRuntimeSettings = logGroupRuntimeSettings;\n }\n Object.defineProperty(AbstractLogger.prototype, \"name\", {\n get: function () {\n return this._name;\n },\n enumerable: true,\n configurable: true\n });\n AbstractLogger.prototype.trace = function (msg, error) {\n if (error === void 0) { error = null; }\n this._log(LoggerOptions_1.LogLevel.Trace, msg, error);\n };\n AbstractLogger.prototype.debug = function (msg, error) {\n if (error === void 0) { error = null; }\n this._log(LoggerOptions_1.LogLevel.Debug, msg, error);\n };\n AbstractLogger.prototype.info = function (msg, error) {\n if (error === void 0) { error = null; }\n this._log(LoggerOptions_1.LogLevel.Info, msg, error);\n };\n AbstractLogger.prototype.warn = function (msg, error) {\n if (error === void 0) { error = null; }\n this._log(LoggerOptions_1.LogLevel.Warn, msg, error);\n };\n AbstractLogger.prototype.error = function (msg, error) {\n if (error === void 0) { error = null; }\n this._log(LoggerOptions_1.LogLevel.Error, msg, error);\n };\n AbstractLogger.prototype.fatal = function (msg, error) {\n if (error === void 0) { error = null; }\n this._log(LoggerOptions_1.LogLevel.Fatal, msg, error);\n };\n AbstractLogger.prototype.tracec = function (msg, error) {\n this._logc(LoggerOptions_1.LogLevel.Trace, msg, error);\n };\n AbstractLogger.prototype.debugc = function (msg, error) {\n this._logc(LoggerOptions_1.LogLevel.Debug, msg, error);\n };\n AbstractLogger.prototype.infoc = function (msg, error) {\n this._logc(LoggerOptions_1.LogLevel.Info, msg, error);\n };\n AbstractLogger.prototype.warnc = function (msg, error) {\n this._logc(LoggerOptions_1.LogLevel.Warn, msg, error);\n };\n AbstractLogger.prototype.errorc = function (msg, error) {\n this._logc(LoggerOptions_1.LogLevel.Error, msg, error);\n };\n AbstractLogger.prototype.fatalc = function (msg, error) {\n this._logc(LoggerOptions_1.LogLevel.Fatal, msg, error);\n };\n AbstractLogger.prototype.isTraceEnabled = function () {\n return this._logGroupRuntimeSettings.level === LoggerOptions_1.LogLevel.Trace;\n };\n AbstractLogger.prototype.isDebugEnabled = function () {\n return this._logGroupRuntimeSettings.level <= LoggerOptions_1.LogLevel.Debug;\n };\n AbstractLogger.prototype.isInfoEnabled = function () {\n return this._logGroupRuntimeSettings.level <= LoggerOptions_1.LogLevel.Info;\n };\n AbstractLogger.prototype.isWarnEnabled = function () {\n return this._logGroupRuntimeSettings.level <= LoggerOptions_1.LogLevel.Warn;\n };\n AbstractLogger.prototype.isErrorEnabled = function () {\n return this._logGroupRuntimeSettings.level <= LoggerOptions_1.LogLevel.Error;\n };\n AbstractLogger.prototype.isFatalEnabled = function () {\n return this._logGroupRuntimeSettings.level <= LoggerOptions_1.LogLevel.Fatal;\n };\n AbstractLogger.prototype.getLogLevel = function () {\n return this._logGroupRuntimeSettings.level;\n };\n AbstractLogger.prototype.isOpen = function () {\n return this._open;\n };\n AbstractLogger.prototype.close = function () {\n this._open = false;\n this._allMessages.clear();\n };\n AbstractLogger.prototype.createDefaultLogMessage = function (msg) {\n return MessageUtils_1.MessageFormatUtils.renderDefaultLog4jMessage(msg, true);\n };\n AbstractLogger.prototype._log = function (level, msg, error) {\n if (error === void 0) { error = null; }\n if (this._open && this._logGroupRuntimeSettings.level <= level) {\n this._allMessages.addTail(this.createMessage(level, msg, new Date(), error));\n this.processMessages();\n }\n };\n AbstractLogger.prototype._logc = function (level, msg, error) {\n if (this._open && this._logGroupRuntimeSettings.level <= level) {\n this._allMessages.addTail(this.createMessage(level, msg(), new Date(), error !== undefined && error !== null ? error() : null));\n this.processMessages();\n }\n };\n AbstractLogger.prototype.createMessage = function (level, msg, date, error) {\n var _this = this;\n if (error === void 0) { error = null; }\n if (error !== null) {\n var message_1 = new LogMessageInternalImpl(this._name, msg, null, error, this._logGroupRuntimeSettings.logGroupRule, date, level, false);\n MessageUtils_1.MessageFormatUtils.renderError(error).then(function (stack) {\n message_1.errorAsStack = stack;\n message_1.ready = true;\n _this.processMessages();\n });\n return message_1;\n }\n return new LogMessageInternalImpl(this._name, msg, null, error, this._logGroupRuntimeSettings.logGroupRule, date, level, true);\n };\n AbstractLogger.prototype.processMessages = function () {\n // Basically we wait until errors are resolved (those messages\n // may not be ready).\n var msgs = this._allMessages;\n if (msgs.getSize() > 0) {\n do {\n var msg = msgs.getHead();\n if (msg != null) {\n if (!msg.ready) {\n break;\n }\n msgs.removeHead();\n // This can never be null normally, but strict null checking ...\n if (msg.message !== null) {\n this.doLog(msg);\n }\n }\n } while (msgs.getSize() > 0);\n }\n };\n return AbstractLogger;\n}());\nexports.AbstractLogger = AbstractLogger;\n//# sourceMappingURL=AbstractLogger.js.map"]}]}