module BarkestLcd::ErrorLogger

Public Instance Methods

error_history() click to toggle source

Contains the last 100 errors that have occurred in this instance.

# File lib/models/error_logger.rb, line 8
def error_history
  @error_history ||= []
end

Protected Instance Methods

log_error(code, msg) click to toggle source
# File lib/models/error_logger.rb, line 14
def log_error(code, msg)
  HIDAPI.debug "Encountered error (#{code.to_s(16).rjust(8, '0')}) #{msg}"
  error_history << [ code, msg, Time.now ]
  error_history.delete_at(0) while error_history.count > 100
end