Skip to content

Commit

Permalink
Use custom logger in api middleware pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
mrfelton committed Mar 13, 2024
1 parent 180ca4d commit cefba35
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ const CACHE_CHECKPERIOD = config.get<number>("cache.checkperiod");

const log = logger(LOGLEVEL);

const middlewareLogger = (message: string, ...rest: string[]) => {
log.info({ msg: message, ...rest });
}

// Log the configuration values.
log.info(config.util.toObject());

Expand Down Expand Up @@ -105,7 +109,7 @@ app.get("/health/live", async (c) => {
});

// Add middleware.
app.use("*", honoLogger());
app.use("*", honoLogger(middlewareLogger));
app.use("*", etag());
app.use("*", cors({ origin: "*" }));
app.use("/static/*", serveStatic({ root: "./" }));
Expand Down

0 comments on commit cefba35

Please sign in to comment.