Class: Discordrb::Logger

Inherits:
Object
  • Object
show all
Defined in:
lib/discordrb/logger.rb

Overview

Logs debug messages

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#debug(message, important = false) ⇒ Object



6
7
8
# File 'lib/discordrb/logger.rb', line 6

def debug(message, important = false)
  puts "[DEBUG : #{Thread.current[:discordrb_name]} @ #{Time.now}] #{message}" if @debug || important
end

Instance Method Details

#log_exception(e, important = true) ⇒ Object



10
11
12
13
# File 'lib/discordrb/logger.rb', line 10

def log_exception(e, important = true)
  debug("Exception: #{e.inspect}", important)
  e.backtrace.each { |line| debug(line, important) }
end