anchor.diff:      inet:setopts(Sock, [{active, once}]),
       {noreply, State#state{buffer=NewBuf}};
   
  -handle_info({tcp_closed, Sock}, State = #state{sock = Sock}) ->
  +handle_info({tcp_closed, Sock}, State = #state{sock = Sock,
  +                                               peername={H,P}}) ->
  +    ?INFO("at=close peer=~s duration=~p",
  +          [logplex_logging:dest(H, P), duration(State)]),
       {stop, normal, State};
   
   handle_info({tcp_error, Sock, Reason},
               State = #state{sock = Sock,
                              peername = {H,P}}) ->
  -    ?WARN("err=gen_tcp peer=~s data=~p",
  -          [loglex_logging:dest(H,P), Reason]),
  +    ?WARN("err=gen_tcp peer=~s data=~p duration=~p",
  +          [loglex_logging:dest(H,P), Reason, duration(State)]),
       {stop, normal, State};
   
   handle_info(Msg, State) ->
  
positive.code: 
  terminate(_Reason, _State) ->
      ok.
  
  code_change(_OldVsn, State, _Extra) ->
      {ok, State}.
  
negative.code:     ?WARN("err=malformed_syslog_message data=\"~p\"~n",
            [Msg]),
      logplex_stats:incr(message_received_malformed).
  
  duration(#state{connect_time=undefined}) ->
      undefined;
  duration(#state{connect_time=T0}) ->
      US = timer:now_diff(os:timestamp(), T0),
      US / 1000000.
  