Is it possible to access final response object (which consumer is going to receive) inside my custom logger service using Response service (@inject(RestBindings.Http.RESPONSE) private response: Response
) or any other injectable class?
#10570
Unanswered
iKrishnaSahu
asked this question in
Q&A
Replies: 1 comment 1 reply
-
I think this should actually work... How did you bind the logger service? Is its scope transient or request? It cannot be higher in the context chain. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is it possible to access final response object (which consumer is going to receive) inside my custom logger service using Response service (
@inject(RestBindings.Http.RESPONSE) private response: Response
) or any other injectable class?I am implementing api logging mechanism in my project. For that, I need response object to be logged inside kibana.
Currently I have a middleware in place which gets invoked at the last after executing the controller logic and all other middleware in between and it has the final logging mechanism which calls a separate method from logger service which logs the log.
Middleware -
Custom logger service -
Something similar is already mentioned in an open ticket - #1881
Beta Was this translation helpful? Give feedback.
All reactions