added webhooklogexcludefunc (#240)

This commit is contained in:
1OSA
2025-02-21 01:21:46 +03:00
committed by GitHub
parent b0bd1f52c4
commit 82a896e83f
4 changed files with 11 additions and 4 deletions

View File

@@ -33,8 +33,11 @@
"logExcludeFunc": [
"SEARCH-CLOSE-TABS"
],
"webhooklogExcludeFunc": [
"SEARCH-CLOSE-TABS"
],
"webhook": {
"enabled": false,
"url": ""
}
}
}

View File

@@ -11,6 +11,7 @@ export interface Config {
searchSettings: SearchSettings;
webhook: Webhook;
logExcludeFunc: string[];
webhooklogExcludeFunc: string[];
saveFingerprint: ConfigSaveFingerprint;
}

View File

@@ -19,7 +19,9 @@ export function log(isMobile: boolean | 'main', title: string, message: string,
const cleanStr = `[${currentTime}] [PID: ${process.pid}] [${type.toUpperCase()}] ${platformText} [${title}] ${message}`
// Send the clean string to the Webhook
Webhook(configData, cleanStr)
if (!configData.webhooklogExcludeFunc.some(x => x.toLowerCase() === title.toLowerCase())) {
Webhook(configData, cleanStr)
}
// Formatted string with chalk for terminal logging
const str = `[${currentTime}] [PID: ${process.pid}] [${type.toUpperCase()}] ${chalkedPlatform} [${title}] ${message}`
@@ -40,4 +42,4 @@ export function log(isMobile: boolean | 'main', title: string, message: string,
applyChalk ? console.log(applyChalk(str)) : console.log(str)
break
}
}
}