Created
August 17, 2018 19:31
-
-
Save senthilmpro/8b260ca98fcbb988467a0599d4797dfe to your computer and use it in GitHub Desktop.
Winston - Node.js basic logging example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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