Sha256: 7377a8fff0114d67b342f5027c0c72f6c18453ec590f319645e4e21d6ba21bcb
Contents?: true
Size: 1.34 KB
Versions: 4
Compression:
Stored size: 1.34 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 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
4 entries across 4 versions & 1 rubygems