Change API to function per level
diff --git a/include/couch_db_tmp.hrl b/include/couch_db_tmp.hrl
index 3a8e9d7..cd3a047 100644
--- a/include/couch_db_tmp.hrl
+++ b/include/couch_db_tmp.hrl
@@ -25,9 +25,9 @@
-define(DEFAULT_ATTACHMENT_CONTENT_TYPE, <<"application/octet-stream">>).
--define(LOG_DEBUG(Format, Args), couch_log:log(debug, Format, Args)).
--define(LOG_INFO(Format, Args), couch_log:log(notice, Format, Args)).
--define(LOG_ERROR(Format, Args), couch_log:log(error, Format, Args)).
+-define(LOG_DEBUG(Format, Args), couch_log:debug(Format, Args)).
+-define(LOG_INFO(Format, Args), couch_log:notice(Format, Args)).
+-define(LOG_ERROR(Format, Args), couch_log:error(Format, Args)).
-record(rev_info,
{
diff --git a/src/fabric_db_delete.erl b/src/fabric_db_delete.erl
index ff81d19..dced33c 100644
--- a/src/fabric_db_delete.erl
+++ b/src/fabric_db_delete.erl
@@ -74,7 +74,7 @@
case {Ok + NotFound, Ok, NotFound} of
{W, 0, W} ->
{#shard{dbname=Name}, _} = hd(Counters),
- couch_log:log(warn, "~p not_found ~s", [?MODULE, Name]),
+ couch_log:warning("~p not_found ~s", [?MODULE, Name]),
{stop, not_found};
{W, _, _} ->
{stop, ok};
diff --git a/src/fabric_db_meta.erl b/src/fabric_db_meta.erl
index 662e2d3..316f10e 100644
--- a/src/fabric_db_meta.erl
+++ b/src/fabric_db_meta.erl
@@ -78,7 +78,7 @@
maybe_finish_set(NewAcc);
handle_set_message(Error, W, Acc) ->
Dst = {W#shard.node, W#shard.name},
- couch_log:log(err, "Failed to set security object on ~p :: ~p", [Dst, Error]),
+ couch_log:error("Failed to set security object on ~p :: ~p", [Dst, Error]),
NewAcc = Acc#acc{workers = (Acc#acc.workers -- [W])},
maybe_finish_set(NewAcc).
@@ -147,7 +147,7 @@
maybe_finish_get(NewAcc);
handle_get_message(Error, W, Acc) ->
Dst = {W#shard.node, W#shard.name},
- couch_log:log(err, "Failed to get security object on ~p :: ~p", [Dst, Error]),
+ couch_log:error("Failed to get security object on ~p :: ~p", [Dst, Error]),
NewAcc = Acc#acc{workers = (Acc#acc.workers -- [W])},
maybe_finish_set(NewAcc).
diff --git a/src/fabric_db_update_listener.erl b/src/fabric_db_update_listener.erl
index 190c582..f85a2cf 100644
--- a/src/fabric_db_update_listener.erl
+++ b/src/fabric_db_update_listener.erl
@@ -89,7 +89,7 @@
{Parent, stop} ->
stop_update_notifiers(Notifiers);
Else ->
- couch_log:log(error, "Unkown message in ~w :: ~w", [?MODULE, Else]),
+ couch_log:error("Unkown message in ~w :: ~w", [?MODULE, Else]),
stop_update_notifiers(Notifiers),
exit(Parent, {unknown_message, Else})
end.
diff --git a/src/fabric_doc_open.erl b/src/fabric_doc_open.erl
index 76bdefd..1562fd8 100644
--- a/src/fabric_doc_open.erl
+++ b/src/fabric_doc_open.erl
@@ -120,7 +120,7 @@
Ctx = #user_ctx{roles=[<<"_admin">>]},
Opts = [replicated_changes, {user_ctx, Ctx}],
Res = fabric:update_docs(DbName, Docs, Opts),
- couch_log:log(notice, "read_repair ~s ~s ~p", [DbName, Id, Res]),
+ couch_log:notice("read_repair ~s ~s ~p", [DbName, Id, Res]),
choose_reply(Docs);
[] ->
% Try hard to return some sort of information
diff --git a/src/fabric_doc_open_revs.erl b/src/fabric_doc_open_revs.erl
index 0165d9c..38f69b9 100644
--- a/src/fabric_doc_open_revs.erl
+++ b/src/fabric_doc_open_revs.erl
@@ -167,7 +167,7 @@
[#doc{id=Id} | _] = Docs,
Ctx = #user_ctx{roles=[<<"_admin">>]},
Res = fabric:update_docs(Db, Docs, [replicated_changes, {user_ctx,Ctx}]),
- couch_log:log(notice, "read_repair ~s ~s ~p", [Db, Id, Res]).
+ couch_log:notice("read_repair ~s ~s ~p", [Db, Id, Res]).
% hackery required so that not_found sorts first
strip_not_found_missing([]) ->
diff --git a/src/fabric_doc_update.erl b/src/fabric_doc_update.erl
index 98982b7..8ec12ac 100644
--- a/src/fabric_doc_update.erl
+++ b/src/fabric_doc_update.erl
@@ -96,7 +96,7 @@
{true, Reply} ->
{Health, W, [{Doc,Reply} | Acc]};
false ->
- couch_log:log(warn, "write quorum (~p) failed for ~s", [W, Doc#doc.id]),
+ couch_log:warning("write quorum (~p) failed for ~s", [W, Doc#doc.id]),
case [Reply || {ok, Reply} <- Replies] of
[] ->
% check if all errors are identical, if so inherit health
diff --git a/src/fabric_rpc.erl b/src/fabric_rpc.erl
index d3ccdc5..3f4f8d2 100644
--- a/src/fabric_rpc.erl
+++ b/src/fabric_rpc.erl
@@ -289,7 +289,7 @@
catch Exception ->
Exception;
error:Reason ->
- couch_log:log(error, "rpc ~p:~p/~p ~p ~p", [M, F, length(A)+1, Reason,
+ couch_log:error("rpc ~p:~p/~p ~p ~p", [M, F, length(A)+1, Reason,
clean_stack()]),
{error, Reason}
end);
@@ -300,7 +300,7 @@
get_or_create_db(DbName, Options) ->
case couch_db:open_int(DbName, Options) of
{not_found, no_db_file} ->
- couch_log:log(warn, "~p creating ~s", [?MODULE, DbName]),
+ couch_log:warning("~p creating ~s", [?MODULE, DbName]),
couch_server:create(DbName, Options);
Else ->
Else
diff --git a/src/fabric_view.erl b/src/fabric_view.erl
index 57d631e..d0c6e45 100644
--- a/src/fabric_view.erl
+++ b/src/fabric_view.erl
@@ -254,7 +254,7 @@
fun(A,A) -> true; (A,B) -> couch_view:less_json(B,A) end.
extract_view(Pid, ViewName, [], _ViewType) ->
- couch_log:log(error, "missing_named_view ~p", [ViewName]),
+ couch_log:error("missing_named_view ~p", [ViewName]),
exit(Pid, kill),
exit(missing_named_view);
extract_view(Pid, ViewName, [View|Rest], ViewType) ->