Skip to content

Commit

Permalink
Fix for debug flag ignore issue
Browse files Browse the repository at this point in the history
Fix for debug flag ignore issue:

#305
  • Loading branch information
michaelhigham authored Jul 18, 2022
1 parent 9ccf211 commit 5dcbbe1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/plugins/output-filter/dropEventsFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ function testCondition (data, fieldName, condition) {
return condition.test(JSON.stringify(value))
}

console.log(String(value))
if (value) {
console.log(String(value))
}
return condition.test(String(value))
}

Expand All @@ -16,7 +18,7 @@ function isLiteralObject (a) {
}

function logStatus (data, debug, a, b, c, d) {
if (debug) {
if (debug === true) {
console.log(
`drop-events plugin: ${a} ${b} ${c} ${d}`.replace(/undefined/g, '-')
)
Expand Down Expand Up @@ -61,12 +63,12 @@ function dropEventsFilter (context, config, eventEmitter, data, callback) {
}
logStatus(debug, 'filter result', drop)
if (drop) {
if (debug) {
if (debug === true) {
logStatus(data, debug, 'drop', JSON.stringify(data))
}
return callback(new Error('drop filter'))
} else {
if (debug) {
if (debug === true) {
logStatus(data, debug, 'pass', JSON.stringify(data))
}
return callback(null, data)
Expand Down

0 comments on commit 5dcbbe1

Please sign in to comment.