Feat: optimze log info

This commit is contained in:
unitwk 2022-08-11 18:02:06 +08:00
parent af282d7154
commit 806a93d39e
2 changed files with 7 additions and 2 deletions

1
.gitignore vendored
View File

@ -18,6 +18,7 @@ dist/
out/
public/
production/
.DS_Store
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

View File

@ -75,8 +75,12 @@ app.use(
// Http log and print
app.use(async (ctx, next) => {
logger.info(`[HTTP] ${ctx.ip} ${ctx.method} - ${ctx.URL.href}`);
logger.info(`[HTTP] ${ctx.session.userName}`);
const ignoreUrls = ["/api/overview", "/api/files/status"];
for (const iterator of ignoreUrls) {
if (ctx.URL.pathname.includes(iterator)) return await next();
}
logger.info(`[HTTP] ${ctx.method}: ${ctx.URL.href}`);
logger.info(`[HTTP] IP: ${ctx.ip} USER: ${ctx.session.userName} UUID: ${ctx.session.uuid}`);
await next();
});