anchor.diff:                               [N,
                                 logplex_syslog_utils:datetime(When)]
                               ).
  +
  +host_str({A,B,C,D}) ->
  +    Quads = [integer_to_list(Quad) || Quad <- [A,B,C,D]],
  +    string:join(Quads,".");
  +host_str(H)
  +  when is_list(H); is_binary(H) ->
  +    H.
  +
  +log_info(#state{id=ID, channel=Channel, host=H, port=P}, Rest)
  +  when is_list(Rest) ->
  +    [ID, Channel, io_lib:format("~s:~p", [host_str(H), P]) | Rest].
  
positive.code:         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]),
              {noreply, reconnect(tcp_error, State)}
      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
  