easy-config-logger
Version:
easy-config-logger is the logger with easy configuration. It is designed for both readability in development and json output in production.
34 lines (33 loc) • 954 B
JavaScript
;
/**
* config
*/
var __assign = (this && this.__assign) || Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
/**
* configuration
*/
var transportConfig = {
dev: {
timestamp: true,
colorize: true,
prettyPrint: true
},
prod: {
timestamp: function () { return new Date(); },
formatter: function (options) {
var level = options.level, message = options.message;
var timestamp = options.timestamp();
var jsonData = __assign({ level: level, message: message, timestamp: timestamp }, options.meta);
return JSON.stringify(jsonData);
}
}
};
exports.transportConfig = transportConfig;