Feat: server-infoエンドポイント / Fix: logger.tsを追跡対象に / Feat: lynqchat-jsを利用可能に / Fix: lynqchat-jsに不足していたエンドポイントを追加

This commit is contained in:
2026-03-19 15:12:26 +09:00
parent bb0bfc1dfd
commit 9e106c14f5
24 changed files with 544 additions and 94 deletions
+34
View File
@@ -0,0 +1,34 @@
import { appendFileSync } from "node:fs";
import { EOL } from "node:os";
const createLog = (
nativeLogger: (...args: any[]) => void,
type: string,
...args: any[]
) => {
if (args[0] instanceof Array) {
args = args[0];
}
const content = `${new Date().toLocaleString()} [${type}] ${args.join("\n").replaceAll("\n", "\n ")}`;
nativeLogger(content);
try {
appendFileSync(
`${import.meta.dirname}/../../../../.log/system.log`,
`${content.toString().replace(/\x1B\[[0-9;]*m/g, '')}${EOL}`
);
} catch (err) {
console.error(`${new Date().toLocaleString()} Logger: Failed to write to file.`);
}
}
const logger = {
log: (...args: any[]) => createLog(console.log, "LOG", args),
info: (...args: any[]) => createLog(console.info, "INFO", args),
error: (...args: any[]) => createLog(console.error, "ERROR", args),
warn: (...args: any[]) => createLog(console.warn, "WARN", args),
}
export default logger;