Fix: loggerのファイル書き込み失敗のログで種別に[]が存在する問題 / Fix: .logを自動作成しディレクトリなしエラーを回避

This commit is contained in:
2026-03-27 22:11:19 +09:00
parent d670e5bf0b
commit d66ab803bc
+4 -2
View File
@@ -1,8 +1,10 @@
import { appendFileSync } from "node:fs";
import { appendFileSync, mkdirSync } from "node:fs";
import { EOL } from "node:os";
const TYPE_MAX_LENGTH = 5;
mkdirSync(`${import.meta.dirname}/../../../../.log`, { recursive: true });
const createLog = (
nativeLogger: (...args: any[]) => void,
type: string,
@@ -25,7 +27,7 @@ const createLog = (
`${content.toString().replace(/\x1B\[[0-9;]*m/g, '')}${EOL}`
);
} catch (err) {
console.error(`${new Date().toLocaleString()} [ERROR] [Lib | logger] Failed to write to file.`);
console.error(`${new Date().toLocaleString()} ERROR [Lib | logger] Failed to write to file.`);
}
}