You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2014/02/13 00:23:42 UTC

couch-replicator commit: updated refs/heads/1843-feature-bigcouch to 17d421e

Updated Branches:
  refs/heads/1843-feature-bigcouch ac78f78e7 -> 17d421eb2


Change API to function per level


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

Branch: refs/heads/1843-feature-bigcouch
Commit: 17d421eb2a4154421b701b886871a07f5a9c7169
Parents: ac78f78
Author: Robert Newson <rn...@apache.org>
Authored: Wed Feb 12 23:23:31 2014 +0000
Committer: Robert Newson <rn...@apache.org>
Committed: Wed Feb 12 23:23:31 2014 +0000

----------------------------------------------------------------------
 src/couch_replicator.erl         | 56 +++++++++++++++++------------------
 src/couch_replicator_httpc.erl   |  6 ++--
 src/couch_replicator_manager.erl | 36 +++++++++++-----------
 src/couch_replicator_worker.erl  | 30 +++++++++----------
 4 files changed, 64 insertions(+), 64 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/17d421eb/src/couch_replicator.erl
----------------------------------------------------------------------
diff --git a/src/couch_replicator.erl b/src/couch_replicator.erl
index c1215a2..ce9ff67 100644
--- a/src/couch_replicator.erl
+++ b/src/couch_replicator.erl
@@ -129,13 +129,13 @@ async_replicate(#rep{id = {BaseId, Ext}, source = Src, target = Tgt} = Rep) ->
     %
     case supervisor:start_child(couch_replicator_job_sup, ChildSpec) of
     {ok, Pid} ->
-        couch_log:log(notice,"starting new replication `~s` at ~p (`~s` -> `~s`)",
+        couch_log:notice("starting new replication `~s` at ~p (`~s` -> `~s`)",
             [RepChildId, Pid, Source, Target]),
         {ok, Pid};
     {error, already_present} ->
         case supervisor:restart_child(couch_replicator_job_sup, RepChildId) of
         {ok, Pid} ->
-            couch_log:log(notice,"restarting replication `~s` at ~p (`~s` -> `~s`)",
+            couch_log:notice("restarting replication `~s` at ~p (`~s` -> `~s`)",
                 [RepChildId, Pid, Source, Target]),
             {ok, Pid};
         {error, running} ->
@@ -155,7 +155,7 @@ async_replicate(#rep{id = {BaseId, Ext}, source = Src, target = Tgt} = Rep) ->
             Error
         end;
     {error, {already_started, Pid}} ->
-        couch_log:log(notice,"replication `~s` already running at ~p (`~s` -> `~s`)",
+        couch_log:notice("replication `~s` already running at ~p (`~s` -> `~s`)",
             [RepChildId, Pid, Source, Target]),
         {ok, Pid};
     {error, {Error, _}} ->
@@ -184,10 +184,10 @@ wait_for_result(RepId) ->
 
 cancel_replication({BaseId, Extension}) ->
     FullRepId = BaseId ++ Extension,
-    couch_log:log(notice,"Canceling replication `~s`...", [FullRepId]),
+    couch_log:notice("Canceling replication `~s`...", [FullRepId]),
     case supervisor:terminate_child(couch_replicator_job_sup, FullRepId) of
     ok ->
-        couch_log:log(notice,"Replication `~s` canceled.", [FullRepId]),
+        couch_log:notice("Replication `~s` canceled.", [FullRepId]),
         case supervisor:delete_child(couch_replicator_job_sup, FullRepId) of
             ok ->
                 {ok, {cancelled, ?l2b(FullRepId)}};
@@ -197,7 +197,7 @@ cancel_replication({BaseId, Extension}) ->
                 Error
         end;
     Error ->
-        couch_log:log(error,"Error canceling replication `~s`: ~p", [FullRepId, Error]),
+        couch_log:error("Error canceling replication `~s`: ~p", [FullRepId, Error]),
         Error
     end.
 
@@ -296,7 +296,7 @@ do_init(#rep{options = Options, id = {BaseId, Ext}, user_ctx=UserCtx} = Rep) ->
     % cancel_replication/1) and then start the replication again, but this is
     % unfortunately not immune to race conditions.
 
-    couch_log:log(notice,"Replication `~p` is using:~n"
+    couch_log:notice("Replication `~p` is using:~n"
         "~c~p worker processes~n"
         "~ca worker batch size of ~p~n"
         "~c~p HTTP connections~n"
@@ -314,7 +314,7 @@ do_init(#rep{options = Options, id = {BaseId, Ext}, user_ctx=UserCtx} = Rep) ->
                 io_lib:format("~n~csource start sequence ~p", [$\t, StartSeq])
             end]),
 
-    couch_log:log(debug,"Worker pids are: ~p", [Workers]),
+    couch_log:debug("Worker pids are: ~p", [Workers]),
 
     couch_replicator_manager:replication_started(Rep),
 
@@ -331,38 +331,38 @@ handle_info(shutdown, St) ->
     {stop, shutdown, St};
 
 handle_info({'DOWN', Ref, _, _, Why}, #rep_state{source_monitor = Ref} = St) ->
-    couch_log:log(error,"Source database is down. Reason: ~p", [Why]),
+    couch_log:error("Source database is down. Reason: ~p", [Why]),
     {stop, source_db_down, St};
 
 handle_info({'DOWN', Ref, _, _, Why}, #rep_state{target_monitor = Ref} = St) ->
-    couch_log:log(error,"Target database is down. Reason: ~p", [Why]),
+    couch_log:error("Target database is down. Reason: ~p", [Why]),
     {stop, target_db_down, St};
 
 handle_info({'EXIT', Pid, normal}, #rep_state{changes_reader=Pid} = State) ->
     {noreply, State};
 
 handle_info({'EXIT', Pid, Reason}, #rep_state{changes_reader=Pid} = State) ->
-    couch_log:log(error,"ChangesReader process died with reason: ~p", [Reason]),
+    couch_log:error("ChangesReader process died with reason: ~p", [Reason]),
     {stop, changes_reader_died, cancel_timer(State)};
 
 handle_info({'EXIT', Pid, normal}, #rep_state{changes_manager = Pid} = State) ->
     {noreply, State};
 
 handle_info({'EXIT', Pid, Reason}, #rep_state{changes_manager = Pid} = State) ->
-    couch_log:log(error,"ChangesManager process died with reason: ~p", [Reason]),
+    couch_log:error("ChangesManager process died with reason: ~p", [Reason]),
     {stop, changes_manager_died, cancel_timer(State)};
 
 handle_info({'EXIT', Pid, normal}, #rep_state{changes_queue=Pid} = State) ->
     {noreply, State};
 
 handle_info({'EXIT', Pid, Reason}, #rep_state{changes_queue=Pid} = State) ->
-    couch_log:log(error,"ChangesQueue process died with reason: ~p", [Reason]),
+    couch_log:error("ChangesQueue process died with reason: ~p", [Reason]),
     {stop, changes_queue_died, cancel_timer(State)};
 
 handle_info({'EXIT', Pid, normal}, #rep_state{workers = Workers} = State) ->
     case Workers -- [Pid] of
     Workers ->
-        couch_log:log(error,"unknown pid bit the dust ~p ~n",[Pid]),
+        couch_log:error("unknown pid bit the dust ~p ~n",[Pid]),
         {noreply, State#rep_state{workers = Workers}};
         %% not clear why a stop was here before
         %%{stop, {unknown_process_died, Pid, normal}, State};
@@ -380,7 +380,7 @@ handle_info({'EXIT', Pid, Reason}, #rep_state{workers = Workers} = State) ->
     false ->
         {stop, {unknown_process_died, Pid, Reason}, State2};
     true ->
-        couch_log:log(error,"Worker ~p died with reason: ~p", [Pid, Reason]),
+        couch_log:error("Worker ~p died with reason: ~p", [Pid, Reason]),
         {stop, {worker_died, Pid, Reason}, State2}
     end;
 
@@ -417,7 +417,7 @@ handle_call({report_seq_done, Seq, StatsInc}, From,
     _ ->
         NewThroughSeq0
     end,
-    couch_log:log(debug,"Worker reported seq ~p, through seq was ~p, "
+    couch_log:debug("Worker reported seq ~p, through seq was ~p, "
         "new through seq is ~p, highest seq done was ~p, "
         "new highest seq done is ~p~n"
         "Seqs in progress were: ~p~nSeqs in progress are now: ~p",
@@ -482,7 +482,7 @@ terminate(Reason, #rep_state{} = State) ->
         target_name = Target,
         rep_details = #rep{id = {BaseId, Ext} = RepId} = Rep
     } = State,
-    couch_log:log(error,"Replication `~s` (`~s` -> `~s`) failed: ~s",
+    couch_log:error("Replication `~s` (`~s` -> `~s`) failed: ~s",
         [BaseId ++ Ext, Source, Target, to_binary(Reason)]),
     terminate_cleanup(State),
     couch_replicator_notifier:notify({error, RepId, Reason}),
@@ -490,7 +490,7 @@ terminate(Reason, #rep_state{} = State) ->
 
 terminate(shutdown, {error, Class, Error, Stack, InitArgs}) ->
     #rep{id=RepId} = InitArgs,
-    couch_log:log(error,"~p:~p: Replication failed to start for args ~p: ~p",
+    couch_log:error("~p:~p: Replication failed to start for args ~p: ~p",
              [Class, Error, InitArgs, Stack]),
     case Error of
     {unauthorized, DbUri} ->
@@ -530,7 +530,7 @@ start_timer(State) ->
     {ok, Ref} ->
         Ref;
     Error ->
-        couch_log:log(error,"Replicator, error scheduling checkpoint:  ~p", [Error]),
+        couch_log:error("Replicator, error scheduling checkpoint:  ~p", [Error]),
         nil
     end.
 
@@ -636,7 +636,7 @@ read_changes(StartSeq, Db, ChangesQueue, Options) ->
                     % Previous CouchDB releases had a bug which allowed a doc
                     % with an empty ID to be inserted into databases. Such doc
                     % is impossible to GET.
-                    couch_log:log(error,"Replicator: ignoring document with empty ID in "
+                    couch_log:error("Replicator: ignoring document with empty ID in "
                         "source database `~s` (_changes sequence ~p)",
                         [couch_replicator_api_wrap:db_uri(Db), Seq]);
                 _ ->
@@ -666,13 +666,13 @@ read_changes(StartSeq, Db, ChangesQueue, Options) ->
             LastSeq = get(last_seq),
             Db2 = case LastSeq of
             StartSeq ->
-                couch_log:log(notice,"Retrying _changes request to source database ~s"
+                couch_log:notice("Retrying _changes request to source database ~s"
                     " with since=~p in ~p seconds",
                     [couch_replicator_api_wrap:db_uri(Db), LastSeq, Db#httpdb.wait / 1000]),
                 ok = timer:sleep(Db#httpdb.wait),
                 Db#httpdb{wait = 2 * Db#httpdb.wait};
             _ ->
-                couch_log:log(notice,"Retrying _changes request to source database ~s"
+                couch_log:notice("Retrying _changes request to source database ~s"
                     " with since=~p", [couch_replicator_api_wrap:db_uri(Db), LastSeq]),
                 Db
             end,
@@ -741,7 +741,7 @@ do_checkpoint(State) ->
          {checkpoint_commit_failure,
              <<"Failure on target commit: ", (to_binary(Reason))/binary>>};
     {SrcInstanceStartTime, TgtInstanceStartTime} ->
-        couch_log:log(notice,"recording a checkpoint for `~s` -> `~s` at source update_seq ~p",
+        couch_log:notice("recording a checkpoint for `~s` -> `~s` at source update_seq ~p",
             [SourceName, TargetName, NewSeq]),
         StartTime = ?l2b(ReplicationStartTime),
         EndTime = ?l2b(couch_util:rfc1123_date()),
@@ -894,22 +894,22 @@ compare_replication_logs(SrcDoc, TgtDoc) ->
     false ->
         SourceHistory = get_value(<<"history">>, RepRecProps, []),
         TargetHistory = get_value(<<"history">>, RepRecPropsTgt, []),
-        couch_log:log(notice,"Replication records differ. "
+        couch_log:notice("Replication records differ. "
                 "Scanning histories to find a common ancestor.", []),
-        couch_log:log(debug,"Record on source:~p~nRecord on target:~p~n",
+        couch_log:debug("Record on source:~p~nRecord on target:~p~n",
                 [RepRecProps, RepRecPropsTgt]),
         compare_rep_history(SourceHistory, TargetHistory)
     end.
 
 compare_rep_history(S, T) when S =:= [] orelse T =:= [] ->
-    couch_log:log(notice,"no common ancestry -- performing full replication", []),
+    couch_log:notice("no common ancestry -- performing full replication", []),
     {?LOWEST_SEQ, []};
 compare_rep_history([{S} | SourceRest], [{T} | TargetRest] = Target) ->
     SourceId = get_value(<<"session_id">>, S),
     case has_session_id(SourceId, Target) of
     true ->
         RecordSeqNum = get_value(<<"recorded_seq">>, S, ?LOWEST_SEQ),
-        couch_log:log(notice,"found a common replication record with source_seq ~p",
+        couch_log:notice("found a common replication record with source_seq ~p",
             [RecordSeqNum]),
         {RecordSeqNum, SourceRest};
     false ->
@@ -917,7 +917,7 @@ compare_rep_history([{S} | SourceRest], [{T} | TargetRest] = Target) ->
         case has_session_id(TargetId, SourceRest) of
         true ->
             RecordSeqNum = get_value(<<"recorded_seq">>, T, ?LOWEST_SEQ),
-            couch_log:log(notice,"found a common replication record with source_seq ~p",
+            couch_log:notice("found a common replication record with source_seq ~p",
                 [RecordSeqNum]),
             {RecordSeqNum, TargetRest};
         false ->

http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/17d421eb/src/couch_replicator_httpc.erl
----------------------------------------------------------------------
diff --git a/src/couch_replicator_httpc.erl b/src/couch_replicator_httpc.erl
index 1cbb382..1f08750 100644
--- a/src/couch_replicator_httpc.erl
+++ b/src/couch_replicator_httpc.erl
@@ -154,7 +154,7 @@ maybe_retry(Error, Worker, #httpdb{retries = Retries, wait = Wait} = HttpDb,
     release_worker(Worker, HttpDb),
     Method = string:to_upper(atom_to_list(get_value(method, Params, get))),
     Url = couch_util:url_strip_password(full_url(HttpDb, Params)),
-    couch_log:log(notice,"Retrying ~s request to ~s in ~p seconds due to error ~s",
+    couch_log:notice("Retrying ~s request to ~s in ~p seconds due to error ~s",
         [Method, Url, Wait / 1000, error_cause(Error)]),
     ok = timer:sleep(Wait),
     Wait2 = erlang:min(Wait * 2, ?MAX_WAIT),
@@ -170,11 +170,11 @@ report_error(Worker, HttpDb, Params, Error) ->
 
 
 do_report_error(Url, Method, {code, Code}) ->
-    couch_log:log(error,"Replicator, request ~s to ~p failed. The received "
+    couch_log:error("Replicator, request ~s to ~p failed. The received "
         "HTTP error code is ~p", [Method, Url, Code]);
 
 do_report_error(FullUrl, Method, Error) ->
-    couch_log:log(error,"Replicator, request ~s to ~p failed due to error ~s",
+    couch_log:error("Replicator, request ~s to ~p failed due to error ~s",
         [Method, FullUrl, error_cause(Error)]).
 
 

http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/17d421eb/src/couch_replicator_manager.erl
----------------------------------------------------------------------
diff --git a/src/couch_replicator_manager.erl b/src/couch_replicator_manager.erl
index c8fa3ac..5ec2d33 100644
--- a/src/couch_replicator_manager.erl
+++ b/src/couch_replicator_manager.erl
@@ -75,7 +75,7 @@ replication_started(#rep{id = {BaseId, _} = RepId}) ->
             {<<"_replication_id">>, ?l2b(BaseId)},
             {<<"_replication_stats">>, undefined}]),
         ok = gen_server:call(?MODULE, {rep_started, RepId}, infinity),
-        couch_log:log(notice, "Document `~s` triggered replication `~s`",
+        couch_log:notice("Document `~s` triggered replication `~s`",
             [DocId, pp_rep_id(RepId)])
     end.
 
@@ -89,7 +89,7 @@ replication_completed(#rep{id = RepId}, Stats) ->
             {<<"_replication_state">>, <<"completed">>},
             {<<"_replication_stats">>, {Stats}}]),
         ok = gen_server:call(?MODULE, {rep_complete, RepId}, infinity),
-        couch_log:log(notice, "Replication `~s` finished (triggered by document `~s`)",
+        couch_log:notice("Replication `~s` finished (triggered by document `~s`)",
             [pp_rep_id(RepId), DocId])
     end.
 
@@ -179,7 +179,7 @@ handle_call({resume_scan, DbName}, _From, State) ->
         [{DbName, EndSeq}] -> EndSeq
     end,
     Pid = changes_feed_loop(DbName, Since),
-    couch_log:log(debug, "Scanning ~s from update_seq ~p", [DbName, Since]),
+    couch_log:debug("Scanning ~s from update_seq ~p", [DbName, Since]),
     {reply, ok, State#state{rep_start_pids = [Pid | State#state.rep_start_pids]}};
 
 handle_call({rep_db_checkpoint, DbName, EndSeq}, _From, State) ->
@@ -190,7 +190,7 @@ handle_call(rep_db_changed, _From, State) ->
     {stop, shutdown, ok, State};
 
 handle_call(Msg, From, State) ->
-    couch_log:log(error, "Replication manager received unexpected call ~p from ~p",
+    couch_log:error("Replication manager received unexpected call ~p from ~p",
         [Msg, From]),
     {stop, {error, {unexpected_call, Msg}}, State}.
 
@@ -198,7 +198,7 @@ handle_cast({set_max_retries, MaxRetries}, State) ->
     {noreply, State#state{max_retries = MaxRetries}};
 
 handle_cast(Msg, State) ->
-    couch_log:log(error, "Replication manager received unexpected cast ~p", [Msg]),
+    couch_log:error("Replication manager received unexpected cast ~p", [Msg]),
     {stop, {error, {unexpected_cast, Msg}}, State}.
 
 handle_info({nodeup, _Node}, State) ->
@@ -208,15 +208,15 @@ handle_info({nodedown, _Node}, State) ->
     {noreply, rescan(State)};
 
 handle_info({'EXIT', From, normal}, #state{scan_pid = From} = State) ->
-    couch_log:log(debug, "Background scan has completed.", []),
+    couch_log:debug("Background scan has completed.", []),
     {noreply, State#state{scan_pid=nil}};
 
 handle_info({'EXIT', From, Reason}, #state{scan_pid = From} = State) ->
-    couch_log:log(error, "Background scanner died. Reason: ~p", [Reason]),
+    couch_log:error("Background scanner died. Reason: ~p", [Reason]),
     {stop, {scanner_died, Reason}, State};
 
 handle_info({'EXIT', From, Reason}, #state{db_notifier = From} = State) ->
-    couch_log:log(error, "Database update notifier died. Reason: ~p", [Reason]),
+    couch_log:error("Database update notifier died. Reason: ~p", [Reason]),
     {stop, {db_update_notifier_died, Reason}, State};
 
 handle_info({'EXIT', From, normal}, #state{rep_start_pids = Pids} = State) ->
@@ -239,7 +239,7 @@ handle_info(shutdown, State) ->
     {stop, shutdown, State};
 
 handle_info(Msg, State) ->
-    couch_log:log(error,"Replication manager received unexpected message ~p", [Msg]),
+    couch_log:error("Replication manager received unexpected message ~p", [Msg]),
     {stop, {unexpected_msg, Msg}, State}.
 
 
@@ -415,7 +415,7 @@ rep_db_update_error(Error, DbName, DocId) ->
     _ ->
         Reason = to_binary(Error)
     end,
-    couch_log:log(error,"Replication manager, error processing document `~s`: ~s",
+    couch_log:error("Replication manager, error processing document `~s`: ~s",
         [DocId, Reason]),
     update_rep_doc(DbName, DocId, [{<<"_replication_state">>, <<"error">>}]).
 
@@ -445,19 +445,19 @@ maybe_start_replication(State, DbName, DocId, RepDoc) ->
         },
         true = ets:insert(?REP_TO_STATE, {RepId, RepState}),
         true = ets:insert(?DOC_TO_REP, {{DbName, DocId}, RepId}),
-        couch_log:log(notice,"Attempting to start replication `~s` (document `~s`).",
+        couch_log:notice("Attempting to start replication `~s` (document `~s`).",
             [pp_rep_id(RepId), DocId]),
         Pid = spawn_link(fun() -> start_replication(Rep, 0) end),
         State#state{rep_start_pids = [Pid | State#state.rep_start_pids]};
     #rep_state{rep = #rep{doc_id = DocId}} ->
         State;
     #rep_state{starting = false, dbname = DbName, rep = #rep{doc_id = OtherDocId}} ->
-        couch_log:log(notice, "The replication specified by the document `~s` was already"
+        couch_log:notice("The replication specified by the document `~s` was already"
             " triggered by the document `~s`", [DocId, OtherDocId]),
         maybe_tag_rep_doc(DbName, DocId, RepDoc, ?l2b(BaseId)),
         State;
     #rep_state{starting = true, dbname = DbName, rep = #rep{doc_id = OtherDocId}} ->
-        couch_log:log(notice, "The replication specified by the document `~s` is already"
+        couch_log:notice("The replication specified by the document `~s` is already"
             " being triggered by the document `~s`", [DocId, OtherDocId]),
         maybe_tag_rep_doc(DbName, DocId, RepDoc, ?l2b(BaseId)),
         State
@@ -527,7 +527,7 @@ rep_doc_deleted(DbName, DocId) ->
         couch_replicator:cancel_replication(RepId),
         true = ets:delete(?REP_TO_STATE, RepId),
         true = ets:delete(?DOC_TO_REP, {DbName, DocId}),
-        couch_log:log(notice, "Stopped replication `~s` because replication document `~s`"
+        couch_log:notice("Stopped replication `~s` because replication document `~s`"
             " was deleted", [pp_rep_id(RepId), DocId]);
     [] ->
         ok
@@ -551,7 +551,7 @@ maybe_retry_replication(#rep_state{retries_left = 0} = RepState, Error, State) -
     couch_replicator:cancel_replication(RepId),
     true = ets:delete(?REP_TO_STATE, RepId),
     true = ets:delete(?DOC_TO_REP, {DbName, DocId}),
-    couch_log:log(error, "Error in replication `~s` (triggered by document `~s`): ~s"
+    couch_log:error("Error in replication `~s` (triggered by document `~s`): ~s"
         "~nReached maximum retry attempts (~p).",
         [pp_rep_id(RepId), DocId, to_binary(error_reason(Error)), MaxRetries]),
     State;
@@ -562,7 +562,7 @@ maybe_retry_replication(RepState, Error, State) ->
     } = RepState,
     #rep_state{wait = Wait} = NewRepState = state_after_error(RepState),
     true = ets:insert(?REP_TO_STATE, {RepId, NewRepState}),
-    couch_log:log(error, "Error in replication `~s` (triggered by document `~s`): ~s"
+    couch_log:error("Error in replication `~s` (triggered by document `~s`): ~s"
         "~nRestarting replication in ~p seconds.",
         [pp_rep_id(RepId), DocId, to_binary(error_reason(Error)), Wait]),
     Pid = spawn_link(fun() -> start_replication(Rep, Wait) end),
@@ -570,7 +570,7 @@ maybe_retry_replication(RepState, Error, State) ->
 
 
 stop_all_replications() ->
-    couch_log:log(notice, "Stopping all ongoing replications because the replicator"
+    couch_log:notice("Stopping all ongoing replications because the replicator"
         " database was deleted or changed", []),
     ets:foldl(
         fun({_, RepId}, _) ->
@@ -605,7 +605,7 @@ update_rep_doc(RepDbName, RepDocId, KVs) when is_binary(RepDocId) ->
     catch
         throw:conflict ->
             Msg = "Conflict when updating replication document `~s`. Retrying.",
-            couch_log:log(error, Msg, [RepDocId]),
+            couch_log:error(Msg, [RepDocId]),
             ok = timer:sleep(5),
             update_rep_doc(RepDbName, RepDocId, KVs)
     end;

http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/17d421eb/src/couch_replicator_worker.erl
----------------------------------------------------------------------
diff --git a/src/couch_replicator_worker.erl b/src/couch_replicator_worker.erl
index 571fcf9..fce445b 100644
--- a/src/couch_replicator_worker.erl
+++ b/src/couch_replicator_worker.erl
@@ -235,7 +235,7 @@ queue_fetch_loop(Source, Target, Parent, Cp, ChangesManager) ->
         close_db(Target2),
         ok = gen_server:call(Cp, {report_seq_done, ReportSeq, Stats}, infinity),
         erlang:put(last_stats_report, now()),
-        couch_log:log(debug,"Worker reported completion of seq ~p", [ReportSeq]),
+        couch_log:debug("Worker reported completion of seq ~p", [ReportSeq]),
         queue_fetch_loop(Source, Target, Parent, Cp, ChangesManager)
     end.
 
@@ -246,9 +246,9 @@ local_process_batch([], _Cp, _Src, _Tgt, #batch{docs = []}, Stats) ->
 local_process_batch([], Cp, Source, Target, #batch{docs = Docs, size = Size}, Stats) ->
     case Target of
     #httpdb{} ->
-        couch_log:log(debug,"Worker flushing doc batch of size ~p bytes", [Size]);
+        couch_log:debug("Worker flushing doc batch of size ~p bytes", [Size]);
     #db{} ->
-        couch_log:log(debug,"Worker flushing doc batch of ~p docs", [Size])
+        couch_log:debug("Worker flushing doc batch of ~p docs", [Size])
     end,
     Stats2 = flush_docs(Target, Docs),
     Stats3 = couch_replicator_utils:sum_stats(Stats, Stats2),
@@ -298,7 +298,7 @@ fetch_doc(Source, {Id, Revs, PAs}, DocHandler, Acc) ->
             Source, Id, Revs, [{atts_since, PAs}, latest], DocHandler, Acc)
     catch
     throw:{missing_stub, _} ->
-        couch_log:log(error,"Retrying fetch and update of document `~s` due to out of "
+        couch_log:error("Retrying fetch and update of document `~s` due to out of "
             "sync attachment stubs. Missing revisions are: ~s",
             [Id, couch_doc:revs_to_strs(Revs)]),
         couch_replicator_api_wrap:open_doc_revs(Source, Id, Revs, [latest], DocHandler, Acc)
@@ -311,7 +311,7 @@ local_doc_handler({ok, Doc}, {Target, DocList, Stats, Cp}) ->
     true ->
         {ok, {Target, [Doc | DocList], Stats2, Cp}};
     false ->
-        couch_log:log(debug,"Worker flushing doc with attachments", []),
+        couch_log:debug("Worker flushing doc with attachments", []),
         Target2 = open_db(Target),
         Success = (flush_doc(Target2, Doc) =:= ok),
         close_db(Target2),
@@ -337,7 +337,7 @@ remote_doc_handler({ok, Doc}, {Parent, Target} = Acc) ->
     % streaming the attachment data from the remote source, therefore it's
     % convenient to call it ASAP to avoid ibrowse inactivity timeouts.
     Stats = #rep_stats{docs_read = 1},
-    couch_log:log(debug,"Worker flushing doc with attachments", []),
+    couch_log:debug("Worker flushing doc with attachments", []),
     Target2 = open_db(Target),
     Success = (flush_doc(Target2, Doc) =:= ok),
     close_db(Target2),
@@ -356,9 +356,9 @@ remote_doc_handler(_, Acc) ->
 spawn_writer(Target, #batch{docs = DocList, size = Size}) ->
     case {Target, Size > 0} of
     {#httpdb{}, true} ->
-        couch_log:log(debug,"Worker flushing doc batch of size ~p bytes", [Size]);
+        couch_log:debug("Worker flushing doc batch of size ~p bytes", [Size]);
     {#db{}, true} ->
-        couch_log:log(debug,"Worker flushing doc batch of ~p docs", [Size]);
+        couch_log:debug("Worker flushing doc batch of ~p docs", [Size]);
     _ ->
         ok
     end,
@@ -399,7 +399,7 @@ maybe_flush_docs(#httpdb{} = Target, Batch, Doc) ->
     #batch{docs = DocAcc, size = SizeAcc} = Batch,
     case batch_doc(Doc) of
     false ->
-        couch_log:log(debug,"Worker flushing doc with attachments", []),
+        couch_log:debug("Worker flushing doc with attachments", []),
         case flush_doc(Target, Doc) of
         ok ->
             {Batch, #rep_stats{docs_written = 1}};
@@ -410,7 +410,7 @@ maybe_flush_docs(#httpdb{} = Target, Batch, Doc) ->
         JsonDoc = ?JSON_ENCODE(couch_doc:to_json_obj(Doc, [revs, attachments])),
         case SizeAcc + iolist_size(JsonDoc) of
         SizeAcc2 when SizeAcc2 > ?DOC_BUFFER_BYTE_SIZE ->
-            couch_log:log(debug,"Worker flushing doc batch of size ~p bytes", [SizeAcc2]),
+            couch_log:debug("Worker flushing doc batch of size ~p bytes", [SizeAcc2]),
             Stats = flush_docs(Target, [JsonDoc | DocAcc]),
             {#batch{}, Stats};
         SizeAcc2 ->
@@ -421,7 +421,7 @@ maybe_flush_docs(#httpdb{} = Target, Batch, Doc) ->
 maybe_flush_docs(#db{} = Target, #batch{docs = DocAcc, size = SizeAcc}, Doc) ->
     case SizeAcc + 1 of
     SizeAcc2 when SizeAcc2 >= ?DOC_BUFFER_LEN ->
-        couch_log:log(debug,"Worker flushing doc batch of ~p docs", [SizeAcc2]),
+        couch_log:debug("Worker flushing doc batch of ~p docs", [SizeAcc2]),
         Stats = flush_docs(Target, [Doc | DocAcc]),
         {#batch{}, Stats};
     SizeAcc2 ->
@@ -448,7 +448,7 @@ flush_docs(Target, DocList) ->
     DbUri = couch_replicator_api_wrap:db_uri(Target),
     lists:foreach(
         fun({Props}) ->
-            couch_log:log(error,"Replicator: couldn't write document `~s`, revision `~s`,"
+            couch_log:error("Replicator: couldn't write document `~s`, revision `~s`,"
                 " to target database `~s`. Error: `~s`, reason: `~s`.",
                 [get_value(id, Props, ""), get_value(rev, Props, ""), DbUri,
                     get_value(error, Props, ""), get_value(reason, Props, "")])
@@ -463,20 +463,20 @@ flush_doc(Target, #doc{id = Id, revs = {Pos, [RevId | _]}} = Doc) ->
     {ok, _} ->
         ok;
     Error ->
-        couch_log:log(error,"Replicator: error writing document `~s` to `~s`: ~s",
+        couch_log:error("Replicator: error writing document `~s` to `~s`: ~s",
             [Id, couch_replicator_api_wrap:db_uri(Target), couch_util:to_binary(Error)]),
         Error
     catch
     throw:{missing_stub, _} = MissingStub ->
         throw(MissingStub);
     throw:{Error, Reason} ->
-        couch_log:log(error,"Replicator: couldn't write document `~s`, revision `~s`,"
+        couch_log:error("Replicator: couldn't write document `~s`, revision `~s`,"
             " to target database `~s`. Error: `~s`, reason: `~s`.",
             [Id, couch_doc:rev_to_str({Pos, RevId}),
                 couch_replicator_api_wrap:db_uri(Target), to_binary(Error), to_binary(Reason)]),
         {error, Error};
     throw:Err ->
-        couch_log:log(error,"Replicator: couldn't write document `~s`, revision `~s`,"
+        couch_log:error("Replicator: couldn't write document `~s`, revision `~s`,"
             " to target database `~s`. Error: `~s`.",
             [Id, couch_doc:rev_to_str({Pos, RevId}),
                 couch_replicator_api_wrap:db_uri(Target), to_binary(Err)]),