anchor.diff:  logger_init_input(_St0) ->
       Me = self(),
       {ok, spawn_link(fun() ->
  +                            %% we register a property so it will work even if we were to
  +                            %% add a second logger instance.
  +                            gproc:reg({p,l,{?MODULE,logger_input}}),
                               aec_events:subscribe(metric),
                               subscriber_loop(Me)
                       end)}.
   
   subscriber_loop(Logger) ->
  -    receive
  -        {gproc_ps_event, metric, #{info := Data}} ->
  -            Logger ! {plugin, self(), Data},
  -            subscriber_loop(Logger)
  +    receive Msg ->
  +            case Msg of
  +                {gproc_ps_event, metric, #{info := Data}} ->
  +                    Logger ! {plugin, self(), Data},
  +                    subscriber_loop(Logger);
  +                {?MODULE, prep_stop, Pid} = Msg ->
  +                    lager:debug("received prep_stop", []),
  +                    Logger ! {plugin, self(), {prep_stop, self(), Pid}},
  +                    exit(normal);
  +                _ ->
  +                    subscriber_loop(Logger)
  +            end
       end.
   
   logger_init_output(filter) ->
  
positive.code: logger_init_output(statsd) ->
      {ok, init_statsd()}.
  
  logger_handle_data(#{} = Data, filter = St) ->
      apply_filter(Data, St);  % sets do_log and do_send flags
  logger_handle_data(#{do_log := true} = Data, log = St) ->
  
negative.code:          {intervals, [{default, 10000}]},
           {report_bulk, true}])).
  
  start_logger(Id) ->
      exometer_report_logger:new(
        [{id, Id},
         {input, [{mode, plugin},
                  {module, ?MODULE},
                  {state, []}]},
         {output, [{mode, plugin},
                   {module, ?MODULE},
                   {state, filter}]},
         {output, [{mode, plugin},
                   {module, ?MODULE},
                   {state, statsd}]},
         {output, [{mode, plugin},
                   {module, ?MODULE},
                   {state, log}]}
        ]).
  
  prep_stop(State) ->
      %% Use disable_reporter/1 instead of remove_reporter/1 since it's
      %% synchronous. We want to avoid spurious errors due to termination
  