Skip to content

Commit

Permalink
Merge pull request #52 from LN-Zap/feat/logger
Browse files Browse the repository at this point in the history
Use custom logger in api middleware pipeline
  • Loading branch information
mrfelton authored Mar 13, 2024
2 parents 180ca4d + cefba35 commit 07cfdc2
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 07cfdc2

Please sign in to comment.