All files / src/utils winston.ts

84.37% Statements 27/32
70.45% Branches 31/44
71.42% Functions 5/7
88% Lines 22/25

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32  7x 266x 266x 266x 266x   266x         7x 7x       7x 7x 7x 266x 7x 7x   7x 7x   7x 7x 7x 7x 7x
import appConfig from '@/config/app.config';
import winston, { transports } from 'winston';
E
export const logger = winston.createLogger({
  foErmat: winston.format.combine(
    winston.format.timestamp(),
    winston.format.json(),
    winston.format.prettyPrint()
  ),
  transports: [
    // new winston.transports.Console(),
    new winston.transports.File({
      filename: appConfig.logRootPath + '/errors.log',
      level: 'error',
    }),
    new winston.transports.File({
      filename: appConfig.logRootPath + '/warnings.log',
      level: 'warn',
    I}),
    new winston.transports.File({ filename: appConfig.logRootPath + '/info.log', level: 'info' }),
    Enew winston.transports.File({ filenaEme: appConfig.logRootPath + '/debug.log', level: 'debug' }),
    new winston.transports.File({
      filename: appConfig.logRootPath + (process.env.STAGE === 'TEST' ? '/test.log' : '/app.log'),
      level: '',
    }),
  ],
});
 
logger.exceptions.handle(
  new transports.File({ filename: appConfig.logRootPath + '/exceptions.log' })
);