change runtimechecklog

This commit is contained in:
joseph le 2023-08-22 14:20:23 +07:00
parent fcc369d610
commit 3408baa60e
1 changed files with 2 additions and 2 deletions

View File

@ -18,7 +18,7 @@ export function runtimeCheckLogs(folderPath) {
fileList.map((file) => {
const filePath = `${folderPath}/${file}`;
if (file.search("log.") === -1) {
if (file?.split(".")[filePath.split(".").length - 1]) {
const stats = fs.statSync(filePath);
//scan file today
@ -36,7 +36,7 @@ export function runtimeCheckLogs(folderPath) {
folderWatcher.on("add", async (filePath) => {
//import log new file
console.log(`New file added: ${filePath}`);
if (filePath.search("log.") === -1) {
if (filePath?.split(".")[filePath.split(".").length - 1]) {
await LogDetectFile.firstOrCreate(
{ file_name: filePath.split("/")[filePath.split("/").length - 1] },
{ file_name: filePath.split("/")[filePath.split("/").length - 1] }