couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject [33/50] chttpd commit: updated refs/heads/master to 58020ab
Date Thu, 28 Aug 2014 11:59:56 GMT
Improve HTTP error log formatting

The use of `~p` for binaries and stacks wasn't very useful. This just
changes things around as well as puts the stack on a new line indented
four spaces so that its readable.

BugzId: 26121


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

Branch: refs/heads/master
Commit: d15303fb3316e2da610241ce7fd5f238e6907e04
Parents: 3f3e916
Author: Paul J. Davis <paul.joseph.davis@gmail.com>
Authored: Thu Dec 12 12:38:10 2013 -0600
Committer: Robert Newson <rnewson@apache.org>
Committed: Thu Jul 31 11:55:09 2014 +0100

----------------------------------------------------------------------
 src/chttpd.erl | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/d15303fb/src/chttpd.erl
----------------------------------------------------------------------
diff --git a/src/chttpd.erl b/src/chttpd.erl
index 372a61d..a783f91 100644
--- a/src/chttpd.erl
+++ b/src/chttpd.erl
@@ -893,8 +893,10 @@ maybe_decompress(Httpd, Body) ->
 log_error_with_stack_trace({bad_request, _, _}) ->
     ok;
 log_error_with_stack_trace({Error, Reason, Stack}) ->
-    couch_log:error("ref: ~p req_err ~p:~p ~p",
-             [stack_hash(Stack), Error, Reason, Stack]);
+    EFmt = if is_binary(Error) -> "~s"; true -> "~w" end,
+    RFmt = if is_binary(Reason) -> "~s"; true -> "~w" end,
+    Fmt = "req_err(~w) " ++ EFmt ++ " : " ++ RFmt ++ "~n    ~p",
+    couch_log:error(Fmt, [stack_hash(Stack), Error, Reason, Stack]);
 log_error_with_stack_trace(_) ->
     ok.
 


Mime
View raw message