anchor.diff:             , "max_queue    (5000)        fail if internal queue gets this long"
              , "max_msg_size (50000)       fail if seeing a msg this big"
              , "buffered     (no)          buffer messages till end of trace"
  -           , "print_form   (\"~s~n\")      print msgs using this format"
              , "print_file   (standard_io) print to this file"
              , "print_msec   (false)       print milliseconds on timestamps"
              , "print_depth  (999999)      formatting depth for \"~P\""
              , "print_re     (\"\")          print only strings that match this"
  +           , "print_pid    ''            custom print handler"
              , "  trc file related opts"
              , "file         (none)        use a trc file based on this name"
              , "file_size    (1)           size of each trc file"
  
positive.code:              , cookie       = ''           % target node cookie
               , buffered     = no           % output buffering
               , arity        = false        % arity instead of args
               , print_call   = true         % print calls (see `return_only')
               , print_form   = "~s~n"       % format for printing
               , print_file   = ""           % file to print to (standard_io)
               , print_msec   = false        % print milliseconds in timestamps?
               , print_depth  = 999999       % Limit for "~P" formatting depth
               , print_re     = ""           % regexp that must match to print
               , max_queue    = 5000         % max # of msgs before suicide
               , max_msg_size = 50000        % max message size before suicide
               , file         = ""           % file to write trace msgs to
  
negative.code:     false-> Cnf#cnf{target=to_atom(Str++"@"++element(2,inet:gethostname()))}
    end.
  
  
  assert_print_fun(Cnf) -> Cnf#cnf{print_fun=def_print_fun(Cnf)}.
  
  spawn_printer(Cnf) ->
    Cnf#cnf{print_pid=spawn_link(fun()->print_init(Cnf#cnf.print_fun) end)}.
  
  def_print_fun(#cnf{print_fun=PF}) when is_function(PF) -> PF;
  def_print_fun(Cnf) ->
    OutFun = mk_out(Cnf),
    fun(Msgs) -> outer(OutFun,Msgs) end.
  
  mk_out(#cnf{file=[_|_]}) ->
    fun(_,_) -> ok end;
  mk_out(#cnf{print_re=RE,print_file=File,print_depth=D,print_msec=MS}) ->
    fun(F,A) ->
        Str=flat(F,[fix_ts(MS,hd(A))|tl(A)]++[D]),
        case RE =:= "" andalso re:run(Str,RE) =:= nomatch of
          true  -> ok;
          false -> io:fwrite(get_fd(File),"~s~n",Str)
        end
    end.
  
  