chore: move access logs to debug (#891)

This commit is contained in:
Nico
2026-05-17 14:26:40 +02:00
committed by GitHub
parent 2a1351382f
commit 3142cb026a

View File

@@ -1,8 +1,8 @@
import { Scalar } from "@scalar/hono-api-reference";
import type { Context, Next } from "hono";
import { Hono } from "hono";
import { bodyLimit } from "hono/body-limit";
import { cors } from "hono/cors";
import { logger as honoLogger } from "hono/logger";
import { secureHeaders } from "hono/secure-headers";
import { rateLimiter } from "hono-rate-limiter";
import { openAPIRouteHandler } from "hono-openapi";
@@ -21,6 +21,20 @@ import { config } from "./core/config";
import { auth } from "~/server/lib/auth";
import { db } from "./db/db";
const requestLogger = async (c: Context, next: Next) => {
const method = c.req.method;
const path = c.req.path;
const start = performance.now();
logger.debug(`<-- ${method} ${path}`);
try {
await next();
} finally {
logger.debug(`--> ${method} ${path} ${c.res.status} ${Math.round(performance.now() - start)}ms`);
}
};
const generalDescriptor = (app: Hono) =>
openAPIRouteHandler(app, {
documentation: {
@@ -49,7 +63,7 @@ export const createApp = () => {
if (config.environment === "production") {
app.use(secureHeaders());
app.use(honoLogger());
app.use(requestLogger);
}
app.use(