* Function to log all activities from ClearUrls. * Only logging when activated. * * @param beforeProcessing the url before the clear process * @param afterProcessing the url after the clear process * @param rule the rule that triggered the process
(beforeProcessing, afterProcessing, rule)
| 286 | * @param rule the rule that triggered the process |
| 287 | */ |
| 288 | function pushToLog(beforeProcessing, afterProcessing, rule) { |
| 289 | const limit = Math.max(0, storage.logLimit); |
| 290 | if (storage.loggingStatus && limit !== 0 && !isNaN(limit)) { |
| 291 | while (storage.log.log.length >= limit |
| 292 | || storage.log.log.length >= logThreshold) { |
| 293 | storage.log.log.shift(); |
| 294 | } |
| 295 | |
| 296 | storage.log.log.push( |
| 297 | { |
| 298 | "before": beforeProcessing, |
| 299 | "after": afterProcessing, |
| 300 | "rule": rule, |
| 301 | "timestamp": Date.now() |
| 302 | } |
| 303 | ); |
| 304 | deferSaveOnDisk('log'); |
| 305 | } |
| 306 | } |
| 307 | |
| 308 | /** |
| 309 | * Checks if the storage is available. |
no test coverage detected