-
-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: create new service for logging metadata from filter #1450
Conversation
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 98eea09. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this branch ✅ Successfully ran 7 targets
Sent with 💌 from NxCloud. |
|
2885616
to
b8d0ae3
Compare
Waiting on nestjs/nest#10545 to handle the websocket part before merging |
Any hopes on this releasing any what soon? |
I'd love to. |
The new `OgmaFilterLogger` an be injected into a service and take in an exception and an arguments host object from Nest and print out metadata according to how the request failed. This will **only** happen, however, if the request has not been logged by an interceptor, meaning there will not be double logging of requests which would make logs noiser. This is done by checking for the existence of the `requestId` added by the interceptor earlier in the call, and the major gain here is that now errors caused by guards or middleware can be caught can logged just as other requests are properly automatically logged as well, making Ogma now fully capable of logging **any** request type into Nest! This feature is opt-in, just as the interceptor is, but the power it brings is major due to now not leaving any requests unlogged. The only downside at the moment is not being able to determing the time length of the request as most underlying transports don't grab the metadata of the start time, but there will be mentions of how users can implement such a feature to allow for that if they so choose.
98eea09
to
96644c9
Compare
The new
OgmaFilterService
an be injected into a service and take in an exception and an arguments host object from Nest and print out metadata according to how the request failed. This will only happen, however, if the request has not been logged by an interceptor, meaning there will not be double logging of requests which would make logs noiser.This is done by checking for the existence of the
requestId
added by the interceptor earlier in the call, and the major gain here is that now errors caused by guards or middleware can be caught can logged just as other requests are properly automatically logged as well, making Ogma now fully capable of logging any request type into Nest! This feature is opt-in, just as the interceptor is, but the power it brings is major due to now not leaving any requests unlogged.The only downside at the moment is not being able to determing the time length of the request as most underlying transports don't grab the metadata of the start time, but there will be mentions of how users can implement such a feature to allow for that if they so choose.