Skip to content
Snippets Groups Projects
logger.js 480 B
const winston = require("winston");

const level = process.env.LOG_LEVEL || 'debug';

const logger = winston.createLogger({
    transports: [
        new winston.transports.Console({
          level: level,
          format: winston.format.combine(
            winston.format.colorize(),
            winston.format.timestamp(),
            winston.format.printf(info => `${info.timestamp} ${info.level}: ${info.message}`)
          )
        })
    ]
});

module.exports = logger