Last change
on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
498 bytes
|
Line | |
---|
1 |
|
---|
2 |
|
---|
3 | const debug = require('debug')('log4js:recording');
|
---|
4 |
|
---|
5 | const recordedEvents = [];
|
---|
6 |
|
---|
7 | function configure() {
|
---|
8 | return function (logEvent) {
|
---|
9 | debug(`received logEvent, number of events now ${recordedEvents.length + 1}`);
|
---|
10 | debug('log event was ', logEvent);
|
---|
11 | recordedEvents.push(logEvent);
|
---|
12 | };
|
---|
13 | }
|
---|
14 |
|
---|
15 | function replay() {
|
---|
16 | return recordedEvents.slice();
|
---|
17 | }
|
---|
18 |
|
---|
19 | function reset() {
|
---|
20 | recordedEvents.length = 0;
|
---|
21 | }
|
---|
22 |
|
---|
23 | module.exports = {
|
---|
24 | configure,
|
---|
25 | replay,
|
---|
26 | playback: replay,
|
---|
27 | reset,
|
---|
28 | erase: reset
|
---|
29 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.