filter out annoyance logs

This commit is contained in:
bignutty 2025-04-07 19:15:40 +02:00
parent d7187154c6
commit 5ec618d2de

View file

@ -6,6 +6,10 @@ const MAINTOWER_BASE_URL = process.env.MAINTOWER_URL
let maintowerClient = "1fepg2wdk-prod" let maintowerClient = "1fepg2wdk-prod"
if(process.env.MAINTOWER_OVERRIDE) maintowerClient = process.env.MAINTOWER_OVERRIDE if(process.env.MAINTOWER_OVERRIDE) maintowerClient = process.env.MAINTOWER_OVERRIDE
const BLOCKED_LOGS = [
"Unknown Message"
]
module.exports.formatErrorMessage = (sev = 0, code, content) => { module.exports.formatErrorMessage = (sev = 0, code, content) => {
return `${icon("webhook_exclaim_" + parseInt(sev))} \`[${Date.now()}]\` @ \`[${process.env.HOSTNAME || "labscore"}]\` **\` ${code} \`** | ${content}` return `${icon("webhook_exclaim_" + parseInt(sev))} \`[${Date.now()}]\` @ \`[${process.env.HOSTNAME || "labscore"}]\` **\` ${code} \`** | ${content}`
} }
@ -33,6 +37,10 @@ module.exports.maintower = async function (packages, type){
module.exports.basecamp = async function (log, content = ""){ module.exports.basecamp = async function (log, content = ""){
if(!MAINTOWER_BASE_URL) { console.warn("No maintower url configured."); return; } if(!MAINTOWER_BASE_URL) { console.warn("No maintower url configured."); return; }
for(const l of BLOCKED_LOGS){
if(log.toString().includes(l)) return;
if(content.toString().includes(l)) return;
}
try{ try{
let res = await superagent.post(MAINTOWER_BASE_URL + 'basecamp') let res = await superagent.post(MAINTOWER_BASE_URL + 'basecamp')
.set({ .set({