cluster-ipc-logger
This logger is designed to collect logs from cluster workers, child processes even independent node.js processes through IPC (Inter-Process Communication).
Preview
Installation
npm i cluster-ipc-logger
Usage
;; if clusterisMaster /* master */ // logger master const logger = debug: true directory: './logs' saveInterval: 60000 // 1 minute ; // logger for master const log = system: 'master' cluster: 0 // log listeners logger ; // detect ^c and save logs before exiting process; // fork workers for let i = 6; i--; cluster; log; log; log; log; log; log; else /* worker */ // logger for worker const log = system: 'worker' cluster: processenvworkerId ; log;
JSON
//log jsonlog;
Note
loggerClient
will catch unhandledRejection
& uncaughtException
and log it as fatal. After sending it to loggerMaster
it will automatically kill the client process with process.exit()
(as it should be).