Skip to content

Commit

Permalink
Merge pull request #306 from sematext/michaelhigham-debugflag-fix
Browse files Browse the repository at this point in the history
Fix for debug flag ignore issue
  • Loading branch information
michaelhigham committed Jul 19, 2022
2 parents 9ccf211 + 5dcbbe1 commit 2bc74a6
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 2bc74a6

Please sign in to comment.