anchor.diff:      couch_replicator:cancel_replication(RepId),
       true = ets:delete(?REP_TO_STATE, RepId),
       true = ets:delete(?DOC_TO_REP, {DbName, DocId}),
  -    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]),
  +    couch_log:error("Error in replication `~s` (triggered by document `~s` from"
  +        " `~s` ): ~s~nReached maximum retry attempts (~p).", [pp_rep_id(RepId),
  +        DocId, DbName, to_binary(error_reason(Error)), MaxRetries]),
       State;
   
   maybe_retry_replication(RepState, Error, State) ->
       #rep_state{
  -        rep = #rep{id = RepId, doc_id = DocId} = Rep
  +        rep = #rep{id = RepId, doc_id = DocId, db_name = DbName} = Rep
       } = RepState,
       #rep_state{wait = Wait} = NewRepState = state_after_error(RepState),
       true = ets:insert(?REP_TO_STATE, {RepId, NewRepState}),
  -    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]),
  +    couch_log:error("Error in replication `~s` (triggered by document `~s` from"
  +        " `~s` ): ~s~nRestarting replication in ~p seconds.", [pp_rep_id(RepId),
  +        DocId, DbName, to_binary(error_reason(Error)), Wait]),
       Pid = spawn_link(?MODULE, start_replication, [Rep, Wait]),
       State#state{
           rep_start_pids = [{rep_start, Pid} | State#state.rep_start_pids]
  
positive.code:             {<<"_replication_state_reason">>, undefined},
              {<<"_replication_stats">>, {Stats}}]),
          ok = gen_server:call(?MODULE, {rep_complete, RepId}, infinity),
          couch_log:notice("Replication `~s` finished (triggered by document `~s`)",
              [pp_rep_id(RepId), DocId])
      end.
  
  
  
negative.code:     case rep_state(RepId) of
      nil ->
          ok;
      #rep_state{rep = #rep{db_name = DbName, doc_id = DocId}} ->
          ok = gen_server:call(?MODULE, {rep_complete, RepId}, infinity),
          couch_log:notice("Replication `~s` usurped by ~s (triggered by document"
              " `~s` from `~s`)", [pp_rep_id(RepId), By, DocId, DbName])
      end.
  
  
  