Skip to content

Instantly share code, notes, and snippets.

@Necmttn
Created February 13, 2019 06:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Necmttn/e704212ccbdc57a1155a68e384741c82 to your computer and use it in GitHub Desktop.
Save Necmttn/e704212ccbdc57a1155a68e384741c82 to your computer and use it in GitHub Desktop.
Better CloudWatch Logs.
const winston = require('winston');
const logger = winston.createLogger({
level: 'debug',
// (typeof(process.env.NODE_ENV) === 'string' && process.env.NODE_ENV.startsWith('prod'))
// ? 'info'
// : 'debug',
format: winston.format.combine(
winston.format.timestamp(),
winston.format.splat(),
winston.format.json()
),
transports: [
new winston.transports.Console()
]
});
module.exports = logger;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment