Failed Conditions
Push — master ( 2a10ca...dc3f81 )
by Yo
01:45
created

lib/logger/taskLogger.js   A

Size

Lines of Code 43

Duplication

Duplicated Lines 0
Ratio 0 %

Test Coverage

Coverage 60%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
nc 1
dl 0
loc 43
ccs 6
cts 10
cp 0.6
rs 10
noi 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A taskLogger.js ➔ ??? 0 5 1
1
"use strict";
2
3 1
const wrapper = require('./wrapper');
4 1
const BaseLogger = require('./EnhancedLogger');
5
6
class TaskLogger extends BaseLogger {
7
8
    constructor(taskName, wrapper) {
9 8
        super(wrapper);
10
11 8
        this.taskName = taskName;
12
    }
13
14
    starting() {
15
        this.info(' Starting ...');
16
    }
17
18
    stopping() {
19
        this.info(' Stopping ...');
20
    }
21
22
    started() {
23
        this.info(' Started');
24
    }
25
26
    stopped() {
27
        this.info(' Stopped');
28
    }
29
30
    /**
31
     * @inheritDoc
32
     */
33
    normalizeMessage(message, meta = {}) {// eslint-disable-line no-unused-vars
34 16
        return `[${this.taskName}]${message}`;
35
    }
36
}
37
38
/**
39
 * @param {string} taskName
40
 *
41
 * @return {TaskLogger} Logger for a task
42
 */
43 8
module.exports = taskName => new TaskLogger(taskName, wrapper);
44
45