File size: 494 Bytes
9de6fa4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | /**
* Structured logging using Winston.
* @module logger
*/
import winston from 'winston';
const { combine, timestamp, json, errors } = winston.format;
export const logger = winston.createLogger({
level: process.env.LOG_LEVEL ?? 'info',
format: combine(timestamp(), errors({ stack: true }), json()),
transports: [
new winston.transports.Console({
format: winston.format.combine(
winston.format.colorize(),
winston.format.simple()
),
}),
],
});
|