-
-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathlogger.js
54 lines (47 loc) · 935 Bytes
/
logger.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
'use strict';
var forEach = require('foreach');
var debug = require('debug')('worker:logger');
/**
* Enable detailed task worker logging.
*
* @example
*
* var worker = Worker(engineEndpoint, {
* use: [
* Logger
* ]
* });
*/
function Logger(worker) {
forEach([
'start',
'stop',
'reschedule',
'error',
'poll',
'poll:done',
'poll:error',
'fetchTasks',
'fetchTasks:failed',
'fetchTasks:success',
'worker:register',
'worker:remove',
'executeTask',
'executeTask:complete',
'executeTask:complete:sent',
'executeTask:failed',
'executeTask:failed:sent',
'executeTask:done',
'executeTask:skip',
'executeTasks',
'executeTasks:done',
'extendLock',
'extendLock:success',
'extendLock:failed',
], function(event) {
worker.on(event, function(...args) {
debug(event, ...args);
});
});
}
module.exports = Logger;