Module: Radfish::Debuggable

Included in:
Client, Core::BaseClient, Core::Session, HttpClient, VendorDetector
Defined in:
lib/radfish.rb

Instance Method Summary collapse

Instance Method Details

#debug(message, level = 1, color = :light_cyan) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/radfish.rb', line 38

def debug(message, level = 1, color = :light_cyan)
  return unless respond_to?(:verbosity) && verbosity >= level
  color_method = color.is_a?(Symbol) && String.method_defined?(color) ? color : :to_s
  puts message.send(color_method)
  
  if respond_to?(:verbosity) && verbosity >= 3 && caller.length > 1
    puts "  Called from:".light_yellow
    caller[1..3].each do |call|
      puts "    #{call}".light_yellow
    end
  end
end