anchor.diff:      {ok, State}.
   
   %% internal functions
  -open_log(Path) ->
  -    {ok, F} = file:open(Path, [raw, append, binary]),
  -    F.
  -
   log_msg(Msg, #state{buffer = Buffer,
                       buffer_size = BufferSize,
                       batch_size = BatchSize} = State) ->
  
positive.code:             maybe_arm_flush_timer(NewState)
      end.
  
  flush_buffer(#state{file = File,
                      buffer = Buffer,
                      buffer_size = BufferSize} = State) ->
      case BufferSize =:= 0 of
          true ->
              State;
          false ->
              ok = file:write(File, Buffer),
              NewState = State#state{buffer = <<>>,
                                     buffer_size = 0},
              cancel_flush_timer(NewState)
      end.
  
negative.code: 
  init([Path, Opts]) ->
      process_flag(trap_exit, true),
  
      BatchSize = proplists:get_value(batch_size, Opts, 524288),
      BatchTimeout = proplists:get_value(batch_timeout, Opts, 1000),
  
      RotationConf = proplists:get_value(rotation, Opts, []),
      RotSize = proplists:get_value(size, RotationConf, 10485760),
      RotNumFiles = proplists:get_value(num_files, RotationConf, 20),
  
      State = #state{path = Path,
                     buffer = <<>>,
                     buffer_size = 0,
                     batch_size = BatchSize,
                     batch_timeout = BatchTimeout,
                     rotation_size = RotSize,
                     rotation_num_files = RotNumFiles},
  
      {ok, open_log_file(State)}.
  
  handle_call({log, Msg}, _From, State) ->
      {reply, ok, log_msg(Msg, State)};
  