anchor.diff:  
       Filename = couch_config:get("log", "file", "couchdb.log"),
       Level = level_integer(list_to_atom(couch_config:get("log", "level", "info"))),
  -    Sasl = list_to_atom(couch_config:get("log", "include_sasl", "true")),
  +    Sasl = couch_config:get("log", "include_sasl", "true") =:= "true",
   
       case ets:info(?MODULE) of
       undefined -> ets:new(?MODULE, [named_table]);
  
positive.code: set_level_integer(Int) ->
      gen_event:call(error_logger, couch_log, {set_level_integer, Int}).
  
  handle_event({Pid, couch_error, {Format, Args}}, {Fd, _LogLevel, _Sasl}=State) ->
      log(Fd, Pid, error, Format, Args),
      {ok, State};
  handle_event({Pid, couch_info, {Format, Args}}, {Fd, LogLevel, _Sasl}=State)
  when LogLevel =< ?LEVEL_INFO ->
      log(Fd, Pid, info, Format, Args),
      {ok, State};
  handle_event({Pid, couch_debug, {Format, Args}}, {Fd, LogLevel, _Sasl}=State)
  when LogLevel =< ?LEVEL_DEBUG ->
      log(Fd, Pid, debug, Format, Args),
      {ok, State};
  handle_event({error_report, _, {Pid, _, _}}=Event, {Fd, _LogLevel, Sasl}=State)
  when Sasl =/= false ->
      log(Fd, Pid, error, "~p", [Event]),
      {ok, State};
  handle_event({error, _, {Pid, Format, Args}}, {Fd, _LogLevel, Sasl}=State)
  when Sasl =/= false ->
      log(Fd, Pid, error, Format, Args),
      {ok, State};
  handle_event({_, _, {Pid, _, _}}=Event, {Fd, LogLevel, _Sasl}=State)
  when LogLevel =< ?LEVEL_TMI ->
      % log every remaining event if tmi!
      log(Fd, Pid, tmi, "~p", [Event]),
      {ok, State};
  handle_event(_Event, State) ->
      {ok, State}.
  
  handle_call({set_level_integer, NewLevel}, {Fd, _LogLevel, Sasl}) ->
      ets:insert(?MODULE, {level, NewLevel}),
      {ok, ok, {Fd, NewLevel, Sasl}}.
  
  handle_info(_Info, State) ->
      {ok, State}.
  
negative.code: -module(couch_log).
  -behaviour(gen_event).
  
  % public API
  -export([start_link/0, stop/0]).
  -export([debug_on/0, info_on/0, get_level/0, get_level_integer/0, set_level/1]).
  -export([read/2]).
  
  % gen_event callbacks
  -export([init/1, handle_event/2, terminate/2, code_change/3]).
  -export([handle_info/2, handle_call/2]).
  
  -define(LEVEL_ERROR, 3).
  -define(LEVEL_INFO, 2).
  -define(LEVEL_DEBUG, 1).
  
  -record(state, {
      fd,
      level,
      sasl,
      eol_re
  }).
  
  level_integer(error)    -> ?LEVEL_ERROR;
  level_integer(info)     -> ?LEVEL_INFO;
  level_integer(debug)    -> ?LEVEL_DEBUG;
  level_integer(_Else)    -> ?LEVEL_ERROR. % anything else default to ERROR level
  
  level_atom(?LEVEL_ERROR) -> error;
  level_atom(?LEVEL_INFO) -> info;
  level_atom(?LEVEL_DEBUG) -> debug.
  
  
  start_link() ->
  