Module: Supermicro::Debuggable

Included in:
Client, Session
Defined in:
lib/supermicro.rb

Instance Method Summary collapse

Instance Method Details

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



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/supermicro.rb', line 16

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