Wednesday, 26 April 2017

File exits after Winston log

I am trying to log all socket.io activities using Winston. But when I run the file with Forever, it logs successfully and restarts. That's not the behavior I want.

How can I prevent the file exiting after logging?

app.js

var winston = require('winston'); // logger

winston.remove(winston.transports.Console);

var logger = new (winston.Logger)({
    transports: [
        new winston.transports.File({
            filename: 'logs/index.log',
            json: false
        })
    ],
    exceptionHandlers: [
        new winston.transports.File({
            filename: 'logs/unhandledExceptions.log',
            handleExceptions: true,
            maxsize: 2000000, // 2mb
            maxFiles: 5,
            json: false
        })
    ],
    exitOnError: false
});

logger.log('info','nodemon');



via Chingiz Mammadli

No comments:

Post a Comment