{"remainingRequest":"/data/node_modules/babel-loader/lib/index.js!/data/node_modules/typescript-logging/dist/commonjs/utils/MessageUtils.js","dependencies":[{"path":"/data/node_modules/typescript-logging/dist/commonjs/utils/MessageUtils.js","mtime":1553611387936},{"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 ST = require(\"stacktrace-js\");\nvar LoggerOptions_1 = require(\"../log/LoggerOptions\");\n/**\n * Some utilities to format messages.\n */\nvar MessageFormatUtils = function () {\n    function MessageFormatUtils() {}\n    /**\n     * Render given date in given DateFormat and return as String.\n     * @param date Date\n     * @param dateFormat Format\n     * @returns {string} Formatted date\n     */\n    MessageFormatUtils.renderDate = function (date, dateFormat) {\n        var lpad = function lpad(value, chars, padWith) {\n            var howMany = chars - value.length;\n            if (howMany > 0) {\n                var res = \"\";\n                for (var i = 0; i < howMany; i++) {\n                    res += padWith;\n                }\n                res += value;\n                return res;\n            }\n            return value;\n        };\n        var fullYear = function fullYear(d) {\n            return lpad(d.getFullYear().toString(), 4, \"0\");\n        };\n        var month = function month(d) {\n            return lpad((d.getMonth() + 1).toString(), 2, \"0\");\n        };\n        var day = function day(d) {\n            return lpad(d.getDate().toString(), 2, \"0\");\n        };\n        var hours = function hours(d) {\n            return lpad(d.getHours().toString(), 2, \"0\");\n        };\n        var minutes = function minutes(d) {\n            return lpad(d.getMinutes().toString(), 2, \"0\");\n        };\n        var seconds = function seconds(d) {\n            return lpad(d.getSeconds().toString(), 2, \"0\");\n        };\n        var millis = function millis(d) {\n            return lpad(d.getMilliseconds().toString(), 3, \"0\");\n        };\n        var dateSeparator = dateFormat.dateSeparator;\n        var ds = \"\";\n        switch (dateFormat.formatEnum) {\n            case LoggerOptions_1.DateFormatEnum.Default:\n                // yyyy-mm-dd hh:mm:ss,m\n                ds = fullYear(date) + dateSeparator + month(date) + dateSeparator + day(date) + \" \" + hours(date) + \":\" + minutes(date) + \":\" + seconds(date) + \",\" + millis(date);\n                break;\n            case LoggerOptions_1.DateFormatEnum.YearMonthDayTime:\n                ds = fullYear(date) + dateSeparator + month(date) + dateSeparator + day(date) + \" \" + hours(date) + \":\" + minutes(date) + \":\" + seconds(date);\n                break;\n            case LoggerOptions_1.DateFormatEnum.YearDayMonthWithFullTime:\n                ds = fullYear(date) + dateSeparator + day(date) + dateSeparator + month(date) + \" \" + hours(date) + \":\" + minutes(date) + \":\" + seconds(date) + \",\" + millis(date);\n                break;\n            case LoggerOptions_1.DateFormatEnum.YearDayMonthTime:\n                ds = fullYear(date) + dateSeparator + day(date) + dateSeparator + month(date) + \" \" + hours(date) + \":\" + minutes(date) + \":\" + seconds(date);\n                break;\n            default:\n                throw new Error(\"Unsupported date format enum: \" + dateFormat.formatEnum);\n        }\n        return ds;\n    };\n    /**\n     * Renders given category log message in default format.\n     * @param msg Message to format\n     * @param addStack If true adds the stack to the output, otherwise skips it\n     * @returns {string} Formatted message\n     */\n    MessageFormatUtils.renderDefaultMessage = function (msg, addStack) {\n        var result = \"\";\n        var logFormat = msg.getLogFormat();\n        if (logFormat.showTimeStamp) {\n            result += MessageFormatUtils.renderDate(msg.getDate(), logFormat.dateFormat) + \" \";\n        }\n        result += LoggerOptions_1.LogLevel[msg.getLevel()].toUpperCase();\n        if (msg.isResolvedErrorMessage()) {\n            result += \" (resolved)\";\n        }\n        result += \" \";\n        if (logFormat.showCategoryName) {\n            result += \"[\";\n            msg.getCategories().forEach(function (value, idx) {\n                if (idx > 0) {\n                    result += \", \";\n                }\n                result += value.name;\n            });\n            result += \"]\";\n        }\n        result += \" \" + msg.getMessage();\n        if (addStack && msg.getErrorAsStack() !== null) {\n            result += \"\\n\" + msg.getErrorAsStack();\n        }\n        return result;\n    };\n    /**\n     * Renders given log4j log message in default format.\n     * @param msg Message to format\n     * @param addStack If true adds the stack to the output, otherwise skips it\n     * @returns {string} Formatted message\n     */\n    MessageFormatUtils.renderDefaultLog4jMessage = function (msg, addStack) {\n        var format = msg.logGroupRule.logFormat;\n        var result = \"\";\n        if (format.showTimeStamp) {\n            result += MessageFormatUtils.renderDate(msg.date, format.dateFormat) + \" \";\n        }\n        result += LoggerOptions_1.LogLevel[msg.level].toUpperCase() + \" \";\n        if (format.showLoggerName) {\n            result += \"[\" + msg.loggerName + \"]\";\n        }\n        result += \" \" + msg.message;\n        if (addStack && msg.errorAsStack !== null) {\n            result += \"\\n\" + msg.errorAsStack;\n        }\n        return result;\n    };\n    /**\n     * Render error as stack\n     * @param error Return error as Promise\n     * @returns {Promise<string>|Promise} Promise for stack\n     */\n    MessageFormatUtils.renderError = function (error) {\n        var result = error.name + \": \" + error.message + \"\\n@\";\n        return new Promise(function (resolve) {\n            // This one has a promise too\n            ST.fromError(error, { offline: true }).then(function (frames) {\n                var stackStr = frames.map(function (frame) {\n                    return frame.toString();\n                }).join(\"\\n  \");\n                result += \"\\n\" + stackStr;\n                // This resolves our returned promise\n                resolve(result);\n            });\n        });\n    };\n    return MessageFormatUtils;\n}();\nexports.MessageFormatUtils = MessageFormatUtils;\n//# sourceMappingURL=MessageUtils.js.map",{"version":3,"sources":["node_modules/typescript-logging/dist/commonjs/utils/MessageUtils.js"],"names":["ST","require","LoggerOptions_1","MessageFormatUtils","renderDate","date","dateFormat","lpad","value","chars","padWith","howMany","length","res","i","fullYear","d","getFullYear","toString","month","getMonth","day","getDate","hours","getHours","minutes","getMinutes","seconds","getSeconds","millis","getMilliseconds","dateSeparator","ds","formatEnum","DateFormatEnum","Default","YearMonthDayTime","YearDayMonthWithFullTime","YearDayMonthTime","Error","renderDefaultMessage","msg","addStack","result","logFormat","getLogFormat","showTimeStamp","LogLevel","getLevel","toUpperCase","isResolvedErrorMessage","showCategoryName","getCategories","forEach","idx","name","getMessage","getErrorAsStack","renderDefaultLog4jMessage","format","logGroupRule","level","showLoggerName","loggerName","message","errorAsStack","renderError","error","Promise","resolve","fromError","offline","then","frames","st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,OAAV,EAAmB;AAClC;AACArE,eAAGsE,SAAH,CAAaH,KAAb,EAAoB,EAAEI,SAAS,IAAX,EAApB,EAAuCC,IAAvC,CAA4C,UAAUC,MAAV,EAAkB;AAC1D,oBAAIC,WAAYD,OAAOE,GAAP,CAAW,UAAUC,KAAV,EAAiB;AACxC,2BAAOA,MAAM1D,QAAN,EAAP;AACH,iBAFe,CAAD,CAEX2D,IAFW,CAEN,MAFM,CAAf;AAGAlC,0BAAU,OAAO+B,QAAjB;AACA;AACAL,wBAAQ1B,MAAR;AACH,aAPD;AAQH,SAVM,CAAP;AAWH,KAbD;AAcA,WAAOxC,kBAAP;AACH,CA/IyB,EAA1B;AAgJA2E,QAAQ3E,kBAAR,GAA6BA,kBAA7B;AACA","file":"MessageUtils.js","sourceRoot":"/data","sourcesContent":["\"use strict\";\nvar ST = require(\"stacktrace-js\");\nvar LoggerOptions_1 = require(\"../log/LoggerOptions\");\n/**\n * Some utilities to format messages.\n */\nvar MessageFormatUtils = (function () {\n    function MessageFormatUtils() {\n    }\n    /**\n     * Render given date in given DateFormat and return as String.\n     * @param date Date\n     * @param dateFormat Format\n     * @returns {string} Formatted date\n     */\n    MessageFormatUtils.renderDate = function (date, dateFormat) {\n        var lpad = function (value, chars, padWith) {\n            var howMany = chars - value.length;\n            if (howMany > 0) {\n                var res = \"\";\n                for (var i = 0; i < howMany; i++) {\n                    res += padWith;\n                }\n                res += value;\n                return res;\n            }\n            return value;\n        };\n        var fullYear = function (d) {\n            return lpad(d.getFullYear().toString(), 4, \"0\");\n        };\n        var month = function (d) {\n            return lpad((d.getMonth() + 1).toString(), 2, \"0\");\n        };\n        var day = function (d) {\n            return lpad(d.getDate().toString(), 2, \"0\");\n        };\n        var hours = function (d) {\n            return lpad(d.getHours().toString(), 2, \"0\");\n        };\n        var minutes = function (d) {\n            return lpad(d.getMinutes().toString(), 2, \"0\");\n        };\n        var seconds = function (d) {\n            return lpad(d.getSeconds().toString(), 2, \"0\");\n        };\n        var millis = function (d) {\n            return lpad(d.getMilliseconds().toString(), 3, \"0\");\n        };\n        var dateSeparator = dateFormat.dateSeparator;\n        var ds = \"\";\n        switch (dateFormat.formatEnum) {\n            case LoggerOptions_1.DateFormatEnum.Default:\n                // yyyy-mm-dd hh:mm:ss,m\n                ds = fullYear(date) + dateSeparator + month(date) + dateSeparator + day(date) + \" \" +\n                    hours(date) + \":\" + minutes(date) + \":\" + seconds(date) + \",\" + millis(date);\n                break;\n            case LoggerOptions_1.DateFormatEnum.YearMonthDayTime:\n                ds = fullYear(date) + dateSeparator + month(date) + dateSeparator + day(date) + \" \" +\n                    hours(date) + \":\" + minutes(date) + \":\" + seconds(date);\n                break;\n            case LoggerOptions_1.DateFormatEnum.YearDayMonthWithFullTime:\n                ds = fullYear(date) + dateSeparator + day(date) + dateSeparator + month(date) + \" \" +\n                    hours(date) + \":\" + minutes(date) + \":\" + seconds(date) + \",\" + millis(date);\n                break;\n            case LoggerOptions_1.DateFormatEnum.YearDayMonthTime:\n                ds = fullYear(date) + dateSeparator + day(date) + dateSeparator + month(date) + \" \" +\n                    hours(date) + \":\" + minutes(date) + \":\" + seconds(date);\n                break;\n            default:\n                throw new Error(\"Unsupported date format enum: \" + dateFormat.formatEnum);\n        }\n        return ds;\n    };\n    /**\n     * Renders given category log message in default format.\n     * @param msg Message to format\n     * @param addStack If true adds the stack to the output, otherwise skips it\n     * @returns {string} Formatted message\n     */\n    MessageFormatUtils.renderDefaultMessage = function (msg, addStack) {\n        var result = \"\";\n        var logFormat = msg.getLogFormat();\n        if (logFormat.showTimeStamp) {\n            result += MessageFormatUtils.renderDate(msg.getDate(), logFormat.dateFormat) + \" \";\n        }\n        result += LoggerOptions_1.LogLevel[msg.getLevel()].toUpperCase();\n        if (msg.isResolvedErrorMessage()) {\n            result += \" (resolved)\";\n        }\n        result += \" \";\n        if (logFormat.showCategoryName) {\n            result += \"[\";\n            msg.getCategories().forEach(function (value, idx) {\n                if (idx > 0) {\n                    result += \", \";\n                }\n                result += value.name;\n            });\n            result += \"]\";\n        }\n        result += \" \" + msg.getMessage();\n        if (addStack && msg.getErrorAsStack() !== null) {\n            result += \"\\n\" + msg.getErrorAsStack();\n        }\n        return result;\n    };\n    /**\n     * Renders given log4j log message in default format.\n     * @param msg Message to format\n     * @param addStack If true adds the stack to the output, otherwise skips it\n     * @returns {string} Formatted message\n     */\n    MessageFormatUtils.renderDefaultLog4jMessage = function (msg, addStack) {\n        var format = msg.logGroupRule.logFormat;\n        var result = \"\";\n        if (format.showTimeStamp) {\n            result += MessageFormatUtils.renderDate(msg.date, format.dateFormat) + \" \";\n        }\n        result += LoggerOptions_1.LogLevel[msg.level].toUpperCase() + \" \";\n        if (format.showLoggerName) {\n            result += \"[\" + msg.loggerName + \"]\";\n        }\n        result += \" \" + msg.message;\n        if (addStack && msg.errorAsStack !== null) {\n            result += \"\\n\" + msg.errorAsStack;\n        }\n        return result;\n    };\n    /**\n     * Render error as stack\n     * @param error Return error as Promise\n     * @returns {Promise<string>|Promise} Promise for stack\n     */\n    MessageFormatUtils.renderError = function (error) {\n        var result = error.name + \": \" + error.message + \"\\n@\";\n        return new Promise(function (resolve) {\n            // This one has a promise too\n            ST.fromError(error, { offline: true }).then(function (frames) {\n                var stackStr = (frames.map(function (frame) {\n                    return frame.toString();\n                })).join(\"\\n  \");\n                result += \"\\n\" + stackStr;\n                // This resolves our returned promise\n                resolve(result);\n            });\n        });\n    };\n    return MessageFormatUtils;\n}());\nexports.MessageFormatUtils = MessageFormatUtils;\n//# sourceMappingURL=MessageUtils.js.map"]}]}