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.

25 lines
1.1 KiB

5 years ago
"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();
5 years ago
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