lib/flexirest/logger.rb in flexirest-1.10.5 vs lib/flexirest/logger.rb in flexirest-1.10.6

- old
+ new

@@ -15,11 +15,11 @@ @logfile = nil @messages = [] end def self.debug(message) - if defined?(Rails) && Rails.respond_to?(:logger) + if defined?(Rails) && Rails.logger.present? Rails.logger.debug(message) elsif @logfile if @logfile.is_a?(String) File.open(@logfile, "a") do |f| f << "#{message}\n" @@ -31,11 +31,11 @@ @messages << message end end def self.info(message) - if defined?(Rails) && Rails.respond_to?(:logger) && Rails.logger + if defined?(Rails) && Rails.logger.present? Rails.logger.info(message) elsif @logfile if @logfile.is_a?(String) File.open(@logfile, "a") do |f| f << "#{message}\n" @@ -47,11 +47,11 @@ @messages << message end end def self.warn(message) - if defined?(Rails) && Rails.respond_to?(:logger) + if defined?(Rails) && Rails.logger.present? Rails.logger.warn(message) elsif @logfile if @logfile.is_a?(String) File.open(@logfile, "a") do |f| f << "#{message}\n" @@ -63,10 +63,10 @@ @messages << message end end def self.error(message) - if defined?(Rails) && Rails.respond_to?(:logger) + if defined?(Rails) && Rails.logger.present? Rails.logger.error(message) elsif @logfile if @logfile.is_a?(String) File.open(@logfile, "a") do |f| f << "#{message}\n"