Attempting to intercept all the requests on webmachine API. I took a copy of webmachine_perf_logger.erl and changed to publish the {verb, resource, module}.
For the posts I'm also interested in BODY. Because the logging part in webmachine_decision_core.erl gets triggered in a different process
respond(Code) ->
....
spawn(fun() -> do_log(LogData) end),
I do not see how can I access the it.
Is there any way to access it or other alternative is appreciated.
Have you experimented with the
finish_request
resource function (https://github.com/basho/webmachine/wiki/Resource-Functions#resource-functions)? Like any other resource function it receives the request data and a context. You could do something like:This would log whatever you extract from request data and context for every request. Note that crashed requests might not call
finish_request
.