anchor.diff:      RotCompress = proplists:get_value(compress, RotationConf, true),
       RotCheckInterval = proplists:get_value(check_interval, RotationConf, 10000),
   
  -    State = #state{path = Path,
  -                   buffer = <<>>,
  +
  +    WorkerState = #worker_state{path = Path,
  +                                rotation_size = RotSize,
  +                                rotation_num_files = RotNumFiles,
  +                                rotation_compress = RotCompress,
  +                                rotation_check_interval = RotCheckInterval},
  +    Worker = spawn_worker(WorkerState),
  +
  +    State = #state{buffer = <<>>,
                      buffer_size = 0,
                      batch_size = BatchSize,
                      batch_timeout = BatchTimeout,
  -                   rotation_size = RotSize,
  -                   rotation_num_files = RotNumFiles,
  -                   rotation_compress = RotCompress,
  -                   rotation_check_interval = RotCheckInterval},
  -
  -    case RotCheckInterval > 0 of
  -        true ->
  -            erlang:send_after(RotCheckInterval, self(), check_file);
  -        false ->
  -            ok
  -    end,
  -
  -    {ok, open_log_file(State)}.
  +                   worker = Worker},
  +
  +    {ok, State}.
   
   handle_call({log, Msg}, _From, State) ->
       {reply, ok, log_msg(Msg, State)};
  -handle_call(sync, _From, State) ->
  -    {reply, ok, sync(State)};
  +handle_call(sync, From, #state{worker = Worker} = State) ->
  +    Parent = self(),
  +    proc_lib:spawn_link(
  +      fun () ->
  +              gen_server:reply(From, gen_server:call(Worker, sync, infinity)),
  +              erlang:unlink(Parent)
  +      end),
  +
  +    {noreply, State};
   handle_call(Request, _From, State) ->
       {stop, {unexpected_call, Request}, State}.
   
  
positive.code:             Error
      end.
  
  maybe_compress_post_rotate(#state{path = Path,
                                    rotation_num_files = NumFiles,
                                    rotation_compress = true})
    when NumFiles > 1 ->
      UncompressedPath = Path ++ ".1",
      CompressedPath = Path ++ ".1.gz",
  
negative.code: 
  %% internal functions
  log_msg(Msg, #state{buffer = Buffer,
                      buffer_size = BufferSize} = State) ->
      NewBuffer = <<Buffer/binary, Msg/binary>>,
      NewBufferSize = BufferSize + byte_size(Msg),
  
      NewState = State#state{buffer = NewBuffer,
                             buffer_size = NewBufferSize},
  
      maybe_flush_buffer(NewState).
  
  maybe_flush_buffer(#state{buffer_size = BufferSize,
                            batch_size = BatchSize} = State) ->
      case BufferSize >= BatchSize of
          true ->
              flush_buffer(State);
          false ->
              maybe_arm_flush_timer(State)
      end.
  
  flush_buffer(#state{worker = Worker,
                      buffer = Buffer,
                      buffer_size = BufferSize} = State) ->
      Worker ! {write, Buffer, BufferSize},
      cancel_flush_timer(State#state{buffer = <<>>,
                                     buffer_size = 0}).
  
  maybe_arm_flush_timer(#state{flush_timer = undefined,
                               batch_timeout = Timeout} = State) ->
  