Skip to content

Commit

Permalink
Add more info to logged output
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhill committed Aug 9, 2023
1 parent cfac880 commit ef865be
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions assets/resources/scriptlets.js
Expand Up @@ -703,14 +703,14 @@ function objectPrune(
}
return true;
};
objectPrune.logJson = (json, logLevel, reNeedle) => {
objectPrune.logJson = (json, msg, reNeedle) => {
if ( reNeedle.test(json) === false ) { return; }
safeSelf().uboLog(`objectPrune() log:${logLevel}`, location.hostname, json);
safeSelf().uboLog(`objectPrune()`, msg, location.hostname, json);
};
}
const jsonBefore = logLevel ? JSON.stringify(obj, null, 2) : '';
if ( logLevel === true || logLevel === 'all' ) {
objectPrune.logJson(jsonBefore, logLevel, reLogNeedle);
objectPrune.logJson(jsonBefore, `prune:"${rawPrunePaths}" log:"${logLevel}"`, reLogNeedle);
}
if ( prunePaths.length === 0 ) { return; }
let outcome = 'nomatch';
Expand All @@ -722,7 +722,7 @@ function objectPrune(
}
}
if ( logLevel === outcome ) {
objectPrune.logJson(jsonBefore, logLevel, reLogNeedle);
objectPrune.logJson(jsonBefore, `prune:"${rawPrunePaths}" log:"${logLevel}"`, reLogNeedle);
}
if ( outcome === 'match' ) { return obj; }
}
Expand Down

0 comments on commit ef865be

Please sign in to comment.