UNPKG

any-restapi-errors

Version:

npm module for handling and logging errors in Node.js API

19 lines (16 loc) 514 B
import winston from 'winston' const logger = winston.createLogger({ level: 'error', format: winston.format.combine( winston.format.timestamp({format: 'YYYY-MM-DD HH:mm:ss'}), winston.format.prettyPrint() ), transports: [ // // - Write all logs with importance level of `error` or higher to `error.log` // (i.e., error, fatal, but not other levels) // new winston.transports.File({ filename: 'error.log', level: 'error' }) ], }); export default logger