mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-07 05:42:57 -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,12 +6,16 @@ const MAINTOWER_BASE_URL = process.env.MAINTOWER_URL
|
|||
let maintowerClient = "1fepg2wdk-prod"
|
||||
if(process.env.MAINTOWER_OVERRIDE) maintowerClient = process.env.MAINTOWER_OVERRIDE
|
||||
|
||||
const BLOCKED_LOGS = [
|
||||
"Unknown Message"
|
||||
]
|
||||
|
||||
module.exports.formatErrorMessage = (sev = 0, code, content) => {
|
||||
return `${icon("webhook_exclaim_" + parseInt(sev))} \`[${Date.now()}]\` @ \`[${process.env.HOSTNAME || "labscore"}]\` **\` ${code} \`** | ${content}`
|
||||
}
|
||||
|
||||
module.exports.maintower = async function (packages, type){
|
||||
if(!MAINTOWER_BASE_URL) { console.warn("No maintower url configured."); return; }
|
||||
if(!MAINTOWER_BASE_URL) { console.warn("No maintower url configured."); return; }
|
||||
try{
|
||||
let res = await superagent.post(MAINTOWER_BASE_URL + 'invoke')
|
||||
.set({
|
||||
|
@ -33,6 +37,10 @@ module.exports.maintower = async function (packages, type){
|
|||
|
||||
module.exports.basecamp = async function (log, content = ""){
|
||||
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{
|
||||
let res = await superagent.post(MAINTOWER_BASE_URL + 'basecamp')
|
||||
.set({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue