anchor.diff:      process_flag(trap_exit, true),
       case file:open(File, [write]) of
   	{ok,Fd} ->
  -	    {ok, {Fd, File, PrevHandler}};
  +	    {ok, #st{fd=Fd,filename=File,prev_handler=PrevHandler}};
   	Error ->
   	    Error
       end.
       
   handle_event({_Type, GL, _Msg}, State) when node(GL) =/= node() ->
       {ok, State};
  -handle_event(Event, {Fd, File, PrevHandler}) ->
  -    write_event(Fd, tag_event(Event)),
  -    {ok, {Fd, File, PrevHandler}};
  -handle_event(_, State) ->
  +handle_event(Event, State) ->
  +    write_event(State, Event),
       {ok, State}.
   
  -handle_info({'EXIT', Fd, _Reason}, {Fd, _File, PrevHandler}) ->
  +handle_info({'EXIT', Fd, _Reason}, #st{fd=Fd,prev_handler=PrevHandler}) ->
       case PrevHandler of
   	[] ->
   	    remove_handler;
  
positive.code: maybe_utc(Time, true) -> {utc, Time};
  maybe_utc(Time, _) -> {local, calendar:universal_time_to_local_time(Time)}.
  
  format_report(Rep) when is_list(Rep) ->
      case string_p(Rep) of
  	true ->
  	    io_lib:format("~s~n",[Rep]);
  	_ ->
  	    format_rep(Rep)
      end;
  format_report(Rep) ->
      io_lib:format("~p~n",[Rep]).
  
  format_rep([{Tag,Data}|Rep]) ->
      io_lib:format("    ~p: ~p~n",[Tag,Data]) ++ format_rep(Rep);
  format_rep([Other|Rep]) ->
      io_lib:format("    ~p~n",[Other]) ++ format_rep(Rep);
  format_rep(_) ->
      [].
  
  add_node(X, Pid) when is_atom(X) ->
      add_node(atom_to_list(X), Pid);
  add_node(X, Pid) when node(Pid) =/= node() ->
      lists:concat([X,"** at node ",node(Pid)," **~n"]);
  add_node(X, _) ->
      X.
  
  string_p([]) ->
      false;
  
negative.code: 	 handle_event/2, handle_call/2, handle_info/2,
  	 terminate/2, code_change/3]).
  
  -record(st,
  	{fd,
  	 filename,
  	 prev_handler}).
  
  %% This one is used when we takeover from the simple error_logger.
  init({File, {error_logger, Buf}}) ->
      case init(File, error_logger) of
  	{ok, State} ->
  	    write_events(State, Buf),
  	    {ok, State};
  	Error ->
  	    Error
      end;
  