fix: filter out after finish response

This commit is contained in:
Methapon2001 2024-04-04 09:15:53 +07:00
parent cd6e2040af
commit 48c9fe1cfd

View file

@ -33,6 +33,8 @@ async function logMiddleware(req: Request, res: Response, next: NextFunction) {
req.app.locals.logData = {};
res.on("finish", () => {
if (!req.url.startsWith("/api/")) return;
const level = LOG_LEVEL_MAP[process.env.LOG_LEVEL ?? "info"] || 1;
if (level === 1 && res.statusCode < 500) return;