You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2014/02/06 18:39:52 UTC

[10/50] [abbrv] couch commit: updated refs/heads/import-rcouch to e2dbc79

Fire a log_request event when requests are logged


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/2048cb32
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/2048cb32
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/2048cb32

Branch: refs/heads/import-rcouch
Commit: 2048cb32a7b8eeba742fa32d3768da18a162969f
Parents: af617d3
Author: Jason Smith (work) <ja...@gmail.com>
Authored: Mon Aug 19 13:16:40 2013 +0000
Committer: Jan Lehnardt <ja...@apache.org>
Committed: Thu Oct 3 16:08:37 2013 +0200

----------------------------------------------------------------------
 couch_httpd.erl | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/2048cb32/couch_httpd.erl
----------------------------------------------------------------------
diff --git a/couch_httpd.erl b/couch_httpd.erl
index 7c89d0e..28932ba 100644
--- a/couch_httpd.erl
+++ b/couch_httpd.erl
@@ -611,13 +611,14 @@ verify_is_server_admin(#user_ctx{roles=Roles}) ->
     false -> throw({unauthorized, <<"You are not a server admin.">>})
     end.
 
-log_request(#httpd{mochi_req=MochiReq,peer=Peer}, Code) ->
+log_request(#httpd{mochi_req=MochiReq,peer=Peer}=Req, Code) ->
     ?LOG_INFO("~s - - ~s ~s ~B", [
         Peer,
         MochiReq:get(method),
         MochiReq:get(raw_path),
         Code
-    ]).
+    ]),
+    gen_event:notify(couch_plugin, {log_request, Req, Code}).
 
 
 start_response_length(#httpd{mochi_req=MochiReq}=Req, Code, Headers, Length) ->