Skip to content

Instantly share code, notes, and snippets.

@gokoro
Created August 12, 2020 14:26
Show Gist options
  • Save gokoro/8ce8fadd52479bbd2c7cc472f8717e41 to your computer and use it in GitHub Desktop.
Save gokoro/8ce8fadd52479bbd2c7cc472f8717e41 to your computer and use it in GitHub Desktop.
Default logging setting for winston package
const winston = require('winston')
const config = require('../config')
const logger = winston.createLogger({
level: config.logLevel,
format: winston.format.combine(
winston.format.errors({ stack: true }),
winston.format.splat(),
winston.format.ms(),
winston.format.json()
),
transports: [
new winston.transports.Console({
format: winston.format.combine(
winston.format.colorize(),
winston.format.simple(),
)
})
]
})
module.exports = logger
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment