format message

This commit is contained in:
joseph le 2023-09-07 14:29:37 +07:00
parent 607c90735a
commit c358da1514
3 changed files with 30 additions and 17 deletions

View File

@ -18,4 +18,9 @@ invalid |IOSXE_RP_NV-3-NV_ACCESS_FAIL|IOSXE_RP_NV-3- shj
invalid |IOSXE_RP_NV-3-NV_ACCESS_FAIL|IOSXE_RP_NV-3- shj
invalid |IOSXE_RP_NV-3-NV_ACCESS_FAIL|IOSXE_RP_NV-3- shj pak_debug_init sdh
abc
123
123 PVDM3- hui 800G2-POE-2
anfasll ak shflks as klhfalk la EHWIC- fsjklfjkl
anfasll ak shflks as klhfalk la EHWIC- fsjklfjkl
anfasll ak shflks as klhfalk la EHWIC- fsjklfjkl
123 PVDM3- hui 800G2-POE-2
123 PVDM3- hui 800G2-POE-2

View File

@ -79,7 +79,7 @@ export async function runtimeCheckLogs(folderPath) {
const filePath = `${folderPath}/${fileName}`;
const scan = fs.watchFile(
filePath,
{ interval: 300000 },
{ interval: 5000 },
async (eventType) => {
//check special item, extra RAM, error in log
let lines = [];
@ -98,6 +98,11 @@ export async function runtimeCheckLogs(folderPath) {
.filter((i) => i.$original.key === "EXCLUDE_ERR")
.map((obj) => obj.$original.value);
let listExtraItem = allValue
.filter((i) => i.$original.key === "MODEL_SPECIAL")
.map((obj) => obj.$original.value);
console.log(listExtraItem)
content.map((line, index) => {
listKeyValues
.map((obj) => obj.$original.value)
@ -160,7 +165,7 @@ export async function runtimeCheckLogs(folderPath) {
let listReport = await getListLineByItem(logsDetect[0]);
let content =
"| |Last updated at | Item/error | Line | Report \n|---|:---:|:---:|:---|:-----------:\n";
"| |Last updated at | Item/error | Line | Report \n|---|:---:|:---|:---|:-----------:\n";
let spoiler = "";
// let file = await fs
// .readFileSync(filePath)
@ -218,6 +223,9 @@ export async function runtimeCheckLogs(folderPath) {
// spoiler = spoiler + "\n```\n\n";
// } else {
listReport.map((log, index) => {
let item = listExtraItem.includes(log.detected_content)
? ":medal: **" + log.detected_content+"**"
: ":small_orange_diamond: "+log.detected_content;
content =
content +
"|" +
@ -225,7 +233,7 @@ export async function runtimeCheckLogs(folderPath) {
"|**" +
moment(log.created_at).format("HH:mm - DD/MM") +
"**|" +
log.detected_content +
item +
"|" +
log.line.sort((a, b) => a - b).join(", ") +
// "|" +
@ -248,17 +256,17 @@ export async function runtimeCheckLogs(folderPath) {
spoiler
);
sendMessToZulip(
"stream",
"AUS_VN_Test",
"Test Log Alerts",
":warning: :warning: **" +
fileName +
"**\n\n" +
content +
"\n\n" +
spoiler
);
// sendMessToZulip(
// "stream",
// "AUS_VN_Test",
// "Test Log Alerts",
// ":warning: :warning: **" +
// fileName +
// "**\n\n" +
// content +
// "\n\n" +
// spoiler
// );
// }, 3000);
}
}, 3000);

View File

@ -1,5 +1,5 @@
const API = "https://logs.danielvu.com/api";
// const API = "http://localhost:3333/api";
// const API = "https://logs.danielvu.com/api";
const API = "http://localhost:3333/api";
export const getKeyValues = API + "/getKeyValue";
export const deleteValue = API + "/deleteValue";
export const addKeyValue = API + "/addValue";