anchor.diff:  
   -record(state, {files}).
   
  +-record(file, {
  +        name :: string(),
  +        level :: integer(),
  +        fd :: port(),
  +        inode :: integer(),
  +        flap=false :: boolean()
  +    }).
  +
  +-define(LOG(Level, Format, Args),
  +    case lager_util:level_to_num(Level) >= lager_mochiglobal:get(loglevel, 0) of
  +        true ->
  +            gen_event:notify(lager_event, {log, lager_util:level_to_num(Level),
  +                    lager_util:format_time(), [io_lib:format("[~p] ~p ", [Level, self()]), io_lib:format(Format, Args)]});
  +        _ -> ok
  +    end).
  +
  +
   init(LogFiles) ->
       Files = [begin
                   case lager_util:open_logfile(Name, true) of
                       {ok, {FD, Inode}} ->
  -                        {Name, lager_util:level_to_num(Level), FD, Inode};
  +                        #file{name=Name, level=lager_util:level_to_num(Level), fd=FD, inode=Inode};
                       Error ->
                           lager:error("Failed to open log file ~s with error ~p",
                               [Name, Error]),
  -                        undefined
  +                        #file{name=Name, level=lager_util:level_to_num(Level), flap=true}
                   end
           end ||
           {Name, Level} <- LogFiles],
  
positive.code: handle_call({set_loglevel, _}, State) ->
      {ok, {error, missing_identifier}, State};
  handle_call({set_loglevel, Ident, Level}, #state{files=Files} = State) ->
      case lists:keyfind(Ident, 1, Files) of
          false ->
              %% no such file exists
              {ok, {error, bad_identifier}, State};
          _ ->
              NewFiles = lists:map(
                  fun({Name, _, FD, Inode}) when Name == Ident ->
                          lager:notice("Changed loglevel of ~s to ~p", [Ident, Level]),
                          {Ident, lager_util:level_to_num(Level), FD, Inode};
                      (X) -> X
                  end, Files),
              {ok, ok, State#state{files=NewFiles}}
      end;
  handle_call(get_loglevel, #state{files=Files} = State) ->
      Result = lists:foldl(fun({_, Level, _, _}, L) -> erlang:min(Level, L);
              (_, L) -> L end, 9,
          Files),
      {ok, Result, State};
  
negative.code: 
  handle_event({log, Level, Time, Message}, #state{files=Files} = State) ->
      NewFiles = lists:map(
          fun(#file{level=L} = File) when Level >= L ->
                  write(File, Level, [Time, " ", Message, "\n"]);
              (File) ->
                  File
  