constlogger=require('ya-node-logger')// full function logger samplelogger.initNewLogger(/* logger name */'main',/* path of log file */'./log/',/* prefix of file name */'main-',/* suffix of file name */'.log',/* compress old file to gz */true,/* hook while writing log file */(type,msg)=>{if(msg.toString().length>4000){console.log(logger.logLevelToColor(type)('** message too long to show on console **'))}else{console.log(logger.logLevelToColor(type)(msg))}})constmainLogger=logger.getLogger('main')// <logLevel: string, logString: string, needTrace: boolean = false>mainLogger('info','some log line.')// console output// 2019-01-01 10:10:00.000 INFO some log line.// dump fatal error sampleprocess.on('unhandledRejection',(reason,p)=>{logger.dumpRawError(reason,'global unhandledRejection, reason')logger.dumpRawError(p,'global unhandledRejection, promise')})// detailed error info will write to (process pwd)/dumped-unexpected-error.txt