anchor.diff:  debug_cmd({trace, false}, Debug) ->
       {ok, remove_debug(trace, Debug)};
   debug_cmd({log, true}, Debug) ->
  -    {_N, Logs} = get_debug(log, Debug, {0, []}),
  -    {ok, install_debug(log, {10, trim(10, Logs)}, Debug)};
  -debug_cmd({log, {true, N}}, Debug) when is_integer(N), N > 0 ->
  -    {_N, Logs} = get_debug(log, Debug, {0, []}),
  -    {ok, install_debug(log, {N, trim(N, Logs)}, Debug)};
  +    NLog = get_debug(log, Debug, nlog_new()),
  +    {ok, install_debug(log, nlog_new(NLog), Debug)};
  +debug_cmd({log, {true, N}}, Debug) when is_integer(N), 1 =< N ->
  +    NLog = get_debug(log, Debug, nlog_new(N)),
  +    {ok, install_debug(log, nlog_new(N, NLog), Debug)};
   debug_cmd({log, false}, Debug) ->
       {ok, remove_debug(log, Debug)};
   debug_cmd({log, print}, Debug) ->
       print_log(Debug),
       {ok, Debug};
   debug_cmd({log, get}, Debug) ->
  -    {_N, Logs} = get_debug(log, Debug, {0, []}),
  -    {{ok, lists:reverse(Logs)}, Debug};
  +    NLog = get_debug(log, Debug, nlog_new()),
  +    {{ok, nlog_get(NLog)}, Debug};
   debug_cmd({log_to_file, false}, Debug) ->
       NDebug = close_log_file(Debug),
       {ok, NDebug};
  
positive.code: -spec print_log(Debug) -> 'ok' when
        Debug :: [dbg_opt()].
  print_log(Debug) ->
      {_N, Logs} = get_debug(log, Debug, {0, []}),
      lists:foreach(fun print_event/1,
  		  lists:reverse(Logs)).
      
  close_log_file(Debug) ->
      case get_debug2(log_to_file, Debug, []) of
  
negative.code: 	    ok = file:close(Fd),
  	    remove_debug(log_to_file, Debug)
      end.
  
  %%-----------------------------------------------------------------
  %% Keep the last N Log functions
  %%-----------------------------------------------------------------
  
  nlog_new() ->
      nlog_new(10).
  %%
  nlog_new(N) when is_integer(N) ->
      {N, []};
  nlog_new(NLog) ->
      nlog_new(10, NLog).
  %%
  nlog_new(NewN, {_N, R}) ->
      {NewN, trim(NewN, R)}.
  
  nlog_put(Item, {N, R}) ->
      {N, [Item | trim(N, R)]}.
  
  nlog_get({_N, R}) ->
      lists:reverse(R).
  
  %%-----------------------------------------------------------------
  %% Func: debug_options/1
  