class DEBUGGER__::Tracer

def initialize ui, pattern: nil, into: nil

def initialize ui, pattern: nil, into: nil
  if /\ADEBUGGER__::(([A-Z][a-z]+?)[A-Z][a-z]+)/ =~ self.class.name
    @name = $1
    @type = $2.downcase
  end
  setup
  if pattern
    @pattern = Regexp.compile(pattern)
  else
    @pattern = nil
  end
  if @into = into
    @output = File.open(into, 'w')
    @output.puts "PID:#{Process.pid} #{self}"
  else
    @output = ui
  end
  @key = [@type, @pattern, @into].freeze
  enable
end