How to force nodejs winston log to file before process exit
问题 I am using winston 3 to log my data. But sometimes it didn't log the error before process exit. The following process will exit, without log to the logfile.log : const winston = require('winston'); winston.add(new winston.transports.File({ filename: 'logfile.log' })); winston.info('please log me in'); process.exit(1); One of attempted solution is used callback: const winston = require('winston'); const logger = new winston.createLogger({ new winston.transports.File({ filename: 'logfile.log' }