Spaces:
Build error
Build error
; | |
Object.defineProperty(exports, "__esModule", { value: true }); | |
exports.logLevelSeverity = exports.makeConsoleLogger = exports.LogLevel = void 0; | |
const utils_1 = require("./utils"); | |
var LogLevel; | |
(function (LogLevel) { | |
LogLevel["DEBUG"] = "debug"; | |
LogLevel["INFO"] = "info"; | |
LogLevel["WARN"] = "warn"; | |
LogLevel["ERROR"] = "error"; | |
})(LogLevel = exports.LogLevel || (exports.LogLevel = {})); | |
function makeConsoleLogger(name) { | |
return (level, message, extraInfo) => { | |
console[level](`${name} ${level}:`, message, extraInfo); | |
}; | |
} | |
exports.makeConsoleLogger = makeConsoleLogger; | |
/** | |
* Transforms a log level into a comparable (numerical) value ordered by severity. | |
*/ | |
function logLevelSeverity(level) { | |
switch (level) { | |
case LogLevel.DEBUG: | |
return 20; | |
case LogLevel.INFO: | |
return 40; | |
case LogLevel.WARN: | |
return 60; | |
case LogLevel.ERROR: | |
return 80; | |
default: | |
return (0, utils_1.assertNever)(level); | |
} | |
} | |
exports.logLevelSeverity = logLevelSeverity; | |
//# sourceMappingURL=logging.js.map |