Skip to content
This repository has been archived by the owner on Jul 8, 2021. It is now read-only.

Using interceptor for logging is not a good idea. Middlewares FTW #5

Open
constb opened this issue Oct 24, 2019 · 0 comments
Open

Using interceptor for logging is not a good idea. Middlewares FTW #5

constb opened this issue Oct 24, 2019 · 0 comments

Comments

@constb
Copy link

constb commented Oct 24, 2019

Request lifecycle in Nest 6.x puts interceptors after guards. That means if some AuthGuard denies request, it won't be logged. Nest middlewares are the very first thing to execute and, conveniently, happen to be express-compatible (even when fastify adapter is used). That makes putting vanilla morgan in app.use() before app.listen() in main.ts the only way to correctly log all requests.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant