Fix: loggerのファイル書き込み失敗のログで種別に[]が存在する問題 / Fix: .logを自動作成しディレクトリなしエラーを回避
This commit is contained in:
@@ -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.`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user