Lint
This commit is contained in:
parent
cb17bba3f5
commit
afd4ad500f
@ -4,7 +4,7 @@ const split = require('split2');
|
|||||||
const logCollector = require('./log-collector');
|
const logCollector = require('./log-collector');
|
||||||
const metricsCollector = require('./metrics-collector');
|
const metricsCollector = require('./metrics-collector');
|
||||||
|
|
||||||
const streams = [process.stdin, split(), logCollector(), metricsCollector(), process.stdout]
|
const streams = [process.stdin, split(), logCollector(), metricsCollector(), process.stdout];
|
||||||
|
|
||||||
pipeline('pipe', streams);
|
pipeline('pipe', streams);
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ const LEVELS = {
|
|||||||
40: 'warn',
|
40: 'warn',
|
||||||
50: 'error',
|
50: 'error',
|
||||||
60: 'fatal'
|
60: 'fatal'
|
||||||
}
|
};
|
||||||
|
|
||||||
module.exports = function logCollector () {
|
module.exports = function logCollector () {
|
||||||
const stream = new Transform({
|
const stream = new Transform({
|
||||||
@ -58,10 +58,9 @@ module.exports = function logCollector () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (accEntry.level > entry.level) {
|
if (accEntry.level > entry.level) {
|
||||||
delete entry.level
|
delete entry.level;
|
||||||
}
|
}
|
||||||
|
|
||||||
let error;
|
|
||||||
if (hasProperty(accEntry, 'error') && hasProperty(entry, 'error')) {
|
if (hasProperty(accEntry, 'error') && hasProperty(entry, 'error')) {
|
||||||
logs.set(id, assingDeep({}, accEntry, entry, { error: accEntry.error.concat(entry.error) }));
|
logs.set(id, assingDeep({}, accEntry, entry, { error: accEntry.error.concat(entry.error) }));
|
||||||
} else {
|
} else {
|
||||||
@ -99,8 +98,8 @@ module.exports = function logCollector () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return stream;
|
return stream;
|
||||||
}
|
};
|
||||||
|
|
||||||
function hasProperty (obj, prop) {
|
function hasProperty (obj, prop) {
|
||||||
return Object.prototype.hasOwnProperty.call(obj, prop)
|
return Object.prototype.hasOwnProperty.call(obj, prop);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user