0

试图拦截 webmachine API 上的所有请求。我拿了一份webmachine_perf_logger.erl并更改为发布 {动词、资源、模块}。

对于帖子,我也对 BODY 感兴趣。因为webmachine_decision_core.erl中的日志记录部分在不同的进程中被触发

 respond(Code) ->
      ....
      spawn(fun() -> do_log(LogData) end),

我看不到如何访问它。

有什么方法可以访问它或其他替代方法表示赞赏。

4

1 回答 1

0

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:

finish_request(ReqData, Context) ->
    do_log(extract_log_data(ReqData, Context)),
    {true, ReqData, Context}.

This would log whatever you extract from request data and context for every request. Note that crashed requests might not call finish_request.

于 2013-07-31T16:24:05.583 回答