Change API to function per level
diff --git a/src/mem3_nodes.erl b/src/mem3_nodes.erl
index f3e17b4..7e97438 100644
--- a/src/mem3_nodes.erl
+++ b/src/mem3_nodes.erl
@@ -69,7 +69,7 @@
{noreply, State}.
handle_info({'DOWN', _, _, Pid, Reason}, #state{changes_pid=Pid} = State) ->
- couch_log:log(notice, "~p changes listener died ~p", [?MODULE, Reason]),
+ couch_log:notice("~p changes listener died ~p", [?MODULE, Reason]),
StartSeq = State#state.update_seq,
Seq = case Reason of {seq, EndSeq} -> EndSeq; _ -> StartSeq end,
erlang:send_after(5000, self(), start_listener),
diff --git a/src/mem3_shards.erl b/src/mem3_shards.erl
index 18afb79..9315c5c 100644
--- a/src/mem3_shards.erl
+++ b/src/mem3_shards.erl
@@ -147,7 +147,7 @@
shard_db_changed ->
{cache_clear(St), get_update_seq()};
_ ->
- couch_log:log(notice, "~p changes listener died ~p", [?MODULE, Reason]),
+ couch_log:notice("~p changes listener died ~p", [?MODULE, Reason]),
{St, get_update_seq()}
end,
erlang:send_after(5000, self(), {start_listener, Seq}),
@@ -218,7 +218,7 @@
false ->
case couch_util:get_value(doc, Change) of
{error, Reason} ->
- couch_log:log(error, "missing partition table for ~s: ~p",
+ couch_log:error("missing partition table for ~s: ~p",
[DbName, Reason]);
{Doc} ->
Shards = mem3_util:build_shards(DbName, Doc),
@@ -268,7 +268,7 @@
{ok, Db} ->
couch_db:close(Db);
Error ->
- couch_log:log(error, "~p tried to create ~s, got ~p",
+ couch_log:error("~p tried to create ~s, got ~p",
[?MODULE, Name, Error])
end
end.
diff --git a/src/mem3_sync.erl b/src/mem3_sync.erl
index dcda1c2..579c515 100644
--- a/src/mem3_sync.erl
+++ b/src/mem3_sync.erl
@@ -134,7 +134,7 @@
handle_info({'EXIT', Active, Reason}, State) ->
NewState = case lists:keyfind(Active, #job.pid, State#state.active) of
#job{name=OldDbName, node=OldNode} = Job ->
- couch_log:log(warn, "~s ~s ~s ~w", [?MODULE, OldDbName, OldNode, Reason]),
+ couch_log:warning("~s ~s ~s ~w", [?MODULE, OldDbName, OldNode, Reason]),
case Reason of {pending_changes, Count} ->
maybe_resubmit(State, Job#job{pid = nil, count = Count});
_ ->
@@ -150,7 +150,7 @@
handle_replication_exit(NewState, Active);
handle_info(Msg, State) ->
- couch_log:log(notice, "unexpected msg at replication manager ~p", [Msg]),
+ couch_log:notice("unexpected msg at replication manager ~p", [Msg]),
{noreply, State}.
terminate(_Reason, State) ->
@@ -221,7 +221,7 @@
if From =/= nil -> gen_server:reply(From, ok); true -> ok end,
State;
false ->
- couch_log:log(debug, "adding ~s -> ~p to mem3_sync queue", [DbName, Node]),
+ couch_log:debug("adding ~s -> ~p to mem3_sync queue", [DbName, Node]),
State#state{
dict = dict:store({DbName,Node}, ok, D),
waiting = in(Job, WQ)
@@ -339,6 +339,6 @@
undefined ->
Node;
Redirect ->
- couch_log:log(debug, "Redirecting push from ~p to ~p", [Node, Redirect]),
+ couch_log:debug("Redirecting push from ~p to ~p", [Node, Redirect]),
list_to_existing_atom(Redirect)
end.
diff --git a/src/mem3_sync_security.erl b/src/mem3_sync_security.erl
index b981768..901b70d 100644
--- a/src/mem3_sync_security.erl
+++ b/src/mem3_sync_security.erl
@@ -37,7 +37,7 @@
end;
Else ->
Args = [DbName, Else],
- couch_log:log(err, "Error checking security objects for ~s :: ~p", Args)
+ couch_log:error("Error checking security objects for ~s :: ~p", Args)
end.
go() ->
@@ -55,18 +55,18 @@
ok ->
ok;
{fixable, SecObj} ->
- couch_log:log(info, "Sync security object for ~p: ~p", [DbName, SecObj]),
+ couch_log:info("Sync security object for ~p: ~p", [DbName, SecObj]),
case fabric:set_security(DbName, SecObj) of
ok -> ok;
Error ->
- couch_log:log(err, "Error setting security object in ~p: ~p",
+ couch_log:error("Error setting security object in ~p: ~p",
[DbName, Error])
end;
broken ->
- couch_log:log(err, "Bad security object in ~p: ~p", [DbName, SecObjs])
+ couch_log:error("Bad security object in ~p: ~p", [DbName, SecObjs])
end;
Error ->
- couch_log:log(err, "Error getting security objects for ~p: ~p", [
+ couch_log:error("Error getting security objects for ~p: ~p", [
DbName, Error])
end.
diff --git a/src/mem3_util.erl b/src/mem3_util.erl
index 8ed1d73..4e73a48 100644
--- a/src/mem3_util.erl
+++ b/src/mem3_util.erl
@@ -155,7 +155,7 @@
n_val(N, NodeCount) when is_list(N) ->
n_val(list_to_integer(N), NodeCount);
n_val(N, NodeCount) when is_integer(NodeCount), N > NodeCount ->
- couch_log:log(error, "Request to create N=~p DB but only ~p node(s)", [N, NodeCount]),
+ couch_log:error("Request to create N=~p DB but only ~p node(s)", [N, NodeCount]),
NodeCount;
n_val(N, _) when N < 1 ->
1;