1234567891011121314151617181920212223242526272829303132333435 |
- 'use strict'
- import winston from 'winston'
- // Logger configuration
- export const logger = winston.createLogger({
- level: 'info',
- format: winston.format.json(),
- transports: [
- new winston.transports.File({ filename: 'logs/server.combined.log' }),
- new winston.transports.File({ filename: 'logs/server.error.log', level: 'error' }),
- new winston.transports.Console({
- level: 'debug',
- handleExceptions: true,
- format: winston.format.json()
- })
- ],
- exitOnError: false
- })
- // Database logger configuration
- export const dbLogger = winston.createLogger({
- level: 'info',
- format: winston.format.json(),
- transports: [
- new winston.transports.File({ filename: 'logs/db.log' }),
- new winston.transports.File({ filename: 'logs/db.error.log', level: 'error' }),
- new winston.transports.Console({
- level: 'debug',
- handleExceptions: true,
- format: winston.format.json()
- })
- ],
- exitOnError: false
- })
|