()
| 9 | const interval = setInterval(sayHello, 100); |
| 10 | |
| 11 | function sayHello() { |
| 12 | n = n + 1; |
| 13 | console.log('Round ', n); |
| 14 | |
| 15 | seq.emit({ |
| 16 | timestamp: new Date(), |
| 17 | level: 'Information', |
| 18 | messageTemplate: 'Hello for the {n}th time, {user}!', |
| 19 | properties: { |
| 20 | user: process.env.USERNAME, |
| 21 | n: n |
| 22 | } |
| 23 | }); |
| 24 | |
| 25 | if (n === 25) { |
| 26 | seq.flush(); |
| 27 | } |
| 28 | |
| 29 | if (n === 100) { |
| 30 | clearInterval(interval); |
| 31 | seq.close(); |
| 32 | } |
| 33 | } |