Skip to content

Instantly share code, notes, and snippets.

@senthilmpro
Created August 17, 2018 19:31
Show Gist options
  • Save senthilmpro/8b260ca98fcbb988467a0599d4797dfe to your computer and use it in GitHub Desktop.
Save senthilmpro/8b260ca98fcbb988467a0599d4797dfe to your computer and use it in GitHub Desktop.
Winston - Node.js basic logging example
const winston = require('winston');
var logger = winston.createLogger({
level : 'info',
format : winston.format.json(),
transports : [
new winston.transports.File({
filename : 'logs/error.log',
level : 'error'
}),
new winston.transports.File({
filename : 'logs/combined.log'
}),
new winston.transports.Console()
]
});
var PORT_NUMBER = 4444;
logger.info("Console successfully started in port : "+ PORT_NUMBER);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment