Change API to function per level
diff --git a/src/chttpd.erl b/src/chttpd.erl
index 2ff7189..7504db4 100644
--- a/src/chttpd.erl
+++ b/src/chttpd.erl
@@ -168,7 +168,7 @@
MethodOverride = MochiReq:get_primary_header_value("X-HTTP-Method-Override"),
Method2 = case lists:member(MethodOverride, ["GET", "HEAD", "POST", "PUT", "DELETE", "TRACE", "CONNECT", "COPY"]) of
true ->
- couch_log:log(notice, "MethodOverride: ~s (real method was ~s)", [MethodOverride, Method1]),
+ couch_log:notice("MethodOverride: ~s (real method was ~s)", [MethodOverride, Method1]),
case Method1 of
'POST' -> couch_util:to_existing_atom(MethodOverride);
_ ->
@@ -218,7 +218,7 @@
throw:{invalid_json, _} ->
send_error(HttpReq, {bad_request, "invalid UTF-8 JSON"});
exit:{mochiweb_recv_error, E} ->
- couch_log:log(notice, LogForClosedSocket ++ " - ~p", [E]),
+ couch_log:notice(LogForClosedSocket ++ " - ~p", [E]),
exit(normal);
throw:Error ->
send_error(HttpReq, Error);
@@ -234,7 +234,7 @@
exit(normal); % Client disconnect (R14)
_Else ->
JsonStack = json_stack({Error, nil, Stack}),
- couch_log:log(error, "req_err ~p:~p ~p", [Tag, Error, JsonStack]),
+ couch_log:error("req_err ~p:~p ~p", [Tag, Error, JsonStack]),
send_error(HttpReq, {Error, nil, Stack})
end
end,
@@ -249,7 +249,7 @@
{aborted, Resp:get(code)}
end,
Host = MochiReq:get_header_value("Host"),
- couch_log:log(notice, "~s ~s ~s ~s ~B ~p ~B", [Peer, Host,
+ couch_log:notice("~s ~s ~s ~s ~B ~p ~B", [Peer, Host,
atom_to_list(Method1), RawUri, Code, Status, round(RequestTime)]),
couch_stats_collector:record({couchdb, request_time}, RequestTime),
case Result of
@@ -258,7 +258,7 @@
{ok, Resp};
{aborted, _, Reason} ->
couch_stats_collector:increment({httpd, aborted_requests}),
- couch_log:log(error, "Response abnormally terminated: ~p", [Reason]),
+ couch_log:error("Response abnormally terminated: ~p", [Reason]),
exit(normal)
end.
diff --git a/src/chttpd_db.erl b/src/chttpd_db.erl
index eb1a1c0..0f2c5e3 100644
--- a/src/chttpd_db.erl
+++ b/src/chttpd_db.erl
@@ -234,7 +234,7 @@
{ok, _} -> ok;
{accepted, _} -> ok;
Error ->
- couch_log:log(debug, "Batch doc error (~s): ~p",[DocId, Error])
+ couch_log:debug("Batch doc error (~s): ~p",[DocId, Error])
end
end),
@@ -646,7 +646,7 @@
{ok, _} -> ok;
{accepted, _} -> ok;
Error ->
- couch_log:log(notice, "Batch doc error (~s): ~p",[DocId, Error])
+ couch_log:notice("Batch doc error (~s): ~p",[DocId, Error])
end
end),
send_json(Req, 202, [], {[
diff --git a/src/chttpd_rewrite.erl b/src/chttpd_rewrite.erl
index c8df271..2a0cf64 100644
--- a/src/chttpd_rewrite.erl
+++ b/src/chttpd_rewrite.erl
@@ -165,7 +165,7 @@
% normalize final path (fix levels "." and "..")
RawPath1 = ?b2l(iolist_to_binary(normalize_path(RawPath))),
- couch_log:log(debug, "rewrite to ~p ~n", [RawPath1]),
+ couch_log:debug("rewrite to ~p ~n", [RawPath1]),
% build a new mochiweb request
MochiReq1 = mochiweb_request:new(MochiReq:get(socket),
@@ -415,7 +415,7 @@
"false" ->
path_to_list(R, [<<"..">>|Acc], DotDotCount+1);
_Else ->
- couch_log:log(notice, "insecure_rewrite_rule ~p blocked", [lists:reverse(Acc) ++ [<<"..">>] ++ R]),
+ couch_log:notice("insecure_rewrite_rule ~p blocked", [lists:reverse(Acc) ++ [<<"..">>] ++ R]),
throw({insecure_rewrite_rule, "too many ../.. segments"})
end;
path_to_list([<<"..">>|R], Acc, DotDotCount) ->