remove log util

This commit is contained in:
musistudio
2025-09-06 09:06:18 +08:00
parent e5741ae470
commit 1a7e90df39
3 changed files with 15 additions and 58 deletions

View File

@@ -14,7 +14,6 @@ import {
import { CONFIG_FILE } from "./constants";
import { createStream } from 'rotating-file-stream';
import { HOME_DIR } from "./constants";
import { configureLogging } from "./utils/log";
import { sessionUsageCache } from "./utils/cache";
import {SSEParserTransform} from "./utils/SSEParser.transform";
import {SSESerializerTransform} from "./utils/SSESerializer.transform";
@@ -63,8 +62,6 @@ async function run(options: RunOptions = {}) {
await cleanupLogFiles();
const config = await initConfig();
// Configure logging based on config
configureLogging(config);
let HOST = config.HOST || "127.0.0.1";
@@ -139,6 +136,15 @@ async function run(options: RunOptions = {}) {
},
logger: loggerConfig,
});
// Add global error handlers to prevent the service from crashing
process.on("uncaughtException", (err) => {
server.log.error("Uncaught exception:", err);
});
process.on("unhandledRejection", (reason, promise) => {
server.log.error("Unhandled rejection at:", promise, "reason:", reason);
});
// Add async preHandler hook for authentication
server.addHook("preHandler", async (req, reply) => {
return new Promise((resolve, reject) => {