1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-05 11:37:01 +02:00

Add more info to logged output

This commit is contained in:
Raymond Hill 2023-08-09 11:18:04 -04:00
parent cfac880cf5
commit ef865bea19
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -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';
@ -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; }
}