module Kernel

Public Instance Methods

sap(msg) click to toggle source
# File lib/super_awesome_print.rb, line 6
def sap(msg)
  SuperAwesomePrint.blank_lines_top
  ap "*** #{Time.now} ***", :color => { :string => :green }
  ap msg.class if msg.respond_to?(:class)
  SuperAwesomePrint.print_caller_lines(caller)
  ap msg
  ap '*** END ***', :color => { :string => :green }
  SuperAwesomePrint.blank_lines_bottom
end
sapf(msg) click to toggle source
# File lib/super_awesome_print.rb, line 16
def sapf(msg)
  file = File.open(SuperAwesomePrint.config.log_file_path , 'a')
  file.puts("*** #{Time.now} ***")
  file.puts(" class: #{msg.class}") if msg.respond_to?(:class)
  lines = caller[0...SuperAwesomePrint.config.caller_lines].map do |line|
    root_path = SuperAwesomePrint.config.root_path
    if root_path.empty?
      line
    else
      line.gsub(root_path + '/', '')
    end
  end
  lines.each { |l| file.puts(' trace: ' + l) }
  file.puts(msg.inspect)
  file.puts('*** END ***')
ensure
  file.close 
end