diff --git a/app/utils/runtimeCheckLogs.ts b/app/utils/runtimeCheckLogs.ts index 0b0d34d..28b4a46 100644 --- a/app/utils/runtimeCheckLogs.ts +++ b/app/utils/runtimeCheckLogs.ts @@ -87,14 +87,13 @@ export async function runtimeCheckLogs(folderPath) { // Watch for changes in the files listed async function watchFilesInList() { //only check new file ---> fileList - fileList_old = new file - let listFileWatch = fileList?.filter((i) => fileList_old.includes(i) === false).map((file) => folderPath + "/" + file) - const watcher = chokidar.watch( - listFileWatch, - { - persistent: true, - interval: 300000, - } - ); + let listFileWatch = fileList + ?.filter((i) => fileList_old.includes(i) === false) + .map((file) => folderPath + "/" + file); + const watcher = chokidar.watch(listFileWatch, { + persistent: true, + interval: 300000, + }); watcher.setMaxListeners(200); @@ -103,6 +102,7 @@ export async function runtimeCheckLogs(folderPath) { // async (eventType) => { //check special item, extra RAM, error in log const fileName = path.split("/")[path.split("/").length - 1]; + // const fileName = path.split("\\")[path.split("\\").length - 1]; const filePath = path; let lines = []; const today = DateTime.now().toFormat("yyyy-MM-dd"); @@ -166,7 +166,7 @@ export async function runtimeCheckLogs(folderPath) { .map((obj) => obj.$original.value) .map(async (value) => { if ( - line.search(value) !== -1 && + line.includes(value) && listExcludeErr.filter((err) => line.includes(err)) .length === 0 ) { @@ -201,8 +201,9 @@ export async function runtimeCheckLogs(folderPath) { listKeyValues .map((obj) => obj.$original.value) .map(async (value) => { + // console.log({line:Array(line), value:Array(value)}) if ( - line.search(value) !== -1 && + line.includes(value) && listExcludeErr.filter((err) => line.includes(err)).length === 0 ) { @@ -216,7 +217,7 @@ export async function runtimeCheckLogs(folderPath) { report.$original.line === index + 1 && report.$original.detected_content === value ); - + if (checkLog?.length === 0) { await LogReport.create({ detected_content: value, @@ -274,7 +275,11 @@ export async function runtimeCheckLogs(folderPath) { "| |Last updated at | Item/error | Line | Report \n|---|:---:|:---|:---|:-----------:\n"; let spoiler = ""; let issueFound = ""; - + let important = [ + "Vxx", + "V00", + "(CAT3K_CAA-UNIVERSALK9-M), Version 16.9.", + ]; listReport.map((log, index) => { let item = listExtraItem.includes(log.detected_content) ? ":medal: **" + log.detected_content + "**" @@ -314,13 +319,16 @@ export async function runtimeCheckLogs(folderPath) { ")\n"; }); + let icon = + important.filter((i) => content.includes(i)).length > 0 + ? "------------\n\n:no_entry: :no_entry:**" + fileName + "**:no_entry: :no_entry:" + : "------------\n\n:warning: :warning: **" + fileName + "**"; sendMessToZulip( "stream", Env.get("ZULIP_STREAM_ALERT"), Env.get("ZULIP_TOPIC_ALERT"), - "------------\n\n:warning: :warning: **" + - fileName + - "**\n\n" + + icon + + "\n\n" + content + "\n\n" + spoiler +