fix: filter out after finish response
This commit is contained in:
parent
cd6e2040af
commit
48c9fe1cfd
1 changed files with 2 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue