Sha256: 2602fd399664595504ac1e1e8be3f08c896a4ee8a4124869070d0997c7e75f0a
Contents?: true
Size: 1.33 KB
Versions: 17
Compression:
Stored size: 1.33 KB
Contents
module ActiveRestClient class Logger @logfile = nil @messages = [] def self.logfile=(value) @logfile = value end def self.messages @messages end def self.reset! @logfile = nil @messages = [] end def self.debug(message) if defined?(Rails) && Rails.respond_to?(:logger) Rails.logger.debug(message) elsif @logfile File.open(@logfile, "a") do |f| f << message end else @messages << message end end def self.info(message) if defined?(Rails) && Rails.respond_to?(:logger) Rails.logger.info(message) elsif @logfile File.open(@logfile, "a") do |f| f << message end else @messages << message end end def self.warn(message) if defined?(Rails) && Rails.respond_to?(:logger) Rails.logger.warn(message) elsif @logfile File.open(@logfile, "a") do |f| f << message end else @messages << message end end def self.error(message) if defined?(Rails) && Rails.respond_to?(:logger) Rails.logger.error(message) elsif @logfile File.open(@logfile, "a") do |f| f << message end else @messages << message end end end end
Version data entries
17 entries across 17 versions & 1 rubygems