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