You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
const expressWinston = require("express-winston");
|
|
|
|
const winston = require("winston");
|
|
|
|
const moment = require("moment");
|
|
|
|
const tsFormat = (ts) => moment(ts).format('YYYY-MM-DD HH:mm:ss').trim();
|
|
|
|
const logger = expressWinston.logger({
|
|
|
|
transports: [
|
|
|
|
new winston.transports.Console()
|
|
|
|
],
|
|
|
|
format: winston.format.combine(winston.format.timestamp(), winston.format.colorize(), winston.format.printf(info => {
|
|
|
|
return `-> ${tsFormat(info.timestamp)}: ${info.message}`;
|
|
|
|
})),
|
|
|
|
meta: false,
|
|
|
|
// msg: "HTTP {{req.method}} {{req.url}}", // optional: customize the default logging message. E.g. "{{res.statusCode}} {{req.method}} {{res.responseTime}}ms {{req.url}}"
|
|
|
|
expressFormat: true,
|
|
|
|
colorize: true,
|
|
|
|
ignoreRoute: function (req, res) {
|
|
|
|
if (req.path.startsWith('/json'))
|
|
|
|
return true; // debugger
|
|
|
|
return false;
|
|
|
|
} // optional: allows to skip some log messages based on request and/or response
|
|
|
|
});
|
|
|
|
exports.default = logger;
|
|
|
|
//# sourceMappingURL=logger.js.map
|