anchor.diff:          ok ->
               {noreply, tcp_good(State)};
           {error, Reason} ->
  -            ?ERR("[~p] (~p:~p) Couldn't write syslog message: ~p",
  -                 [State#state.id, State#state.host, State#state.port,
  -                  Reason]),
  +            ?ERR("drain_id=~p channel_id=~p dest=~s at=post err=gen_tcp data=~p",
  +                 log_info(State, [Reason])),
               {noreply, reconnect(tcp_error, State)}
       end;
   
  
positive.code:             Msg = case Item of
                        {msg, M} -> M;
                        {loss_indication, N, When} ->
                            ?INFO("Drain ~s dropped ~p messages since ~s.",
                                  [ID, N, logplex_syslog_utils:datetime(When)]),
                            overflow_msg(N, When)
                    end,
              case post(Msg, S, ID) of
                  ok ->
                      post_buffer(tcp_good(State#state{buf=NewBuf}));
                  {error, Reason} ->
                      ?ERR("[~p] (~p:~p) Couldn't write syslog message: ~p",
                           [State#state.id, State#state.host, State#state.port,
                            Reason]),
                      reconnect(tcp_error, tcp_bad(State#state{sock=undefined}))
              end
      end.
  
negative.code:     State1 = State#state{tref = undefined},
      case connect(State1) of
          {ok, Sock} ->
              ?INFO("drain_id=~p channel_id=~p dest=~s at=connected try=~p",
                    log_info(State1, [State1#state.failures + 1])),
              NewState = tcp_good(State1#state{sock=Sock}),
              {noreply, post_buffer(NewState)};
          {error, Reason} ->
              NewState = tcp_bad(State1),
              ?ERR("drain_id=~p channel_id=~p dest=~s at=connect "
                   "err=gen_tcp data=~p try=~p last_success=~s",
                   log_info(State, [Reason, NewState#state.failures,
                                    time_failed(NewState)])),
              {noreply, reconnect(tcp_error, NewState)}
      end;
  
  handle_info({tcp_closed, S}, State = #state{sock = S}) ->
      ?INFO("drain_id=~p channel_id=~p dest=~s at=close",
            log_info(State, [])),
      {noreply, reconnect(tcp_closed, State#state{sock=undefined})};
  
  handle_info({tcp_error, S, Reason}, State = #state{sock = S}) ->
      ?ERR("drain_id=~p channel_id=~p dest=~s at=idle "
           "err=gen_tcp data=~p",
            log_info(State, [Reason])),
      {noreply, reconnect(tcp_error, State#state{sock=undefined})};
  
  handle_info({tcp, S, Data}, State = #state{sock = S}) ->
      ?WARN("drain_id=~p channel_id=~p dest=~s err=unexpected_peer_data data=~p",
            log_info(State, [Data])),
      {noreply, State};
  
  handle_info(Info, State) ->
      ?WARN("drain_id=~p channel_id=~p dest=~s err=unexpected_info data=~p",
            log_info(State, [Info])),
      {noreply, State}.
  
  %% @private
  