mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-08 14:13:02 -04:00
filter out annoyance logs
This commit is contained in:
parent
d7187154c6
commit
5ec618d2de
1 changed files with 9 additions and 1 deletions
|
@ -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({
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue