All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nodejs-express-server.logger.mustache Maven / Gradle / Ivy

The newest version!
const winston = require('winston');

const logger = winston.createLogger({
  level: 'info',
  format: winston.format.json(),
  defaultMeta: { service: 'user-service' },
  transports: [
    new winston.transports.File({ filename: 'error.log', level: 'error' }),
    new winston.transports.File({ filename: 'combined.log' }),
  ],
});

if (process.env.NODE_ENV !== 'production') {
  logger.add(new winston.transports.Console({ format: winston.format.simple() }));
}

module.exports = logger;




© 2015 - 2024 Weber Informatics LLC | Privacy Policy