1 | const cluster = require('cluster');
|
2 | module.exports = () => {
|
3 |
|
4 |
|
5 | cluster.on('listening', (worker, address) => {
|
6 | consol.title(`# Worker ${worker.id} is serving your application on port ${address.port}`);
|
7 | });
|
8 |
|
9 |
|
10 | Object.keys(cluster.workers).forEach((id) => {
|
11 | cluster.workers[id].on('message',(msg)=>{
|
12 | if(msg.type === "info") consol.info(msg.content);
|
13 | if(msg.type === "warning") consol.warning(msg.content);
|
14 | if(msg.type === "error") consol.error(msg.content);
|
15 | if(msg.type === "success") consol.success(msg.content);
|
16 | });
|
17 | });
|
18 |
|
19 | }; |
\ | No newline at end of file |