Class: EasyMailchimp::Logger

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(logger) ⇒ Logger

Returns a new instance of Logger.



3
4
5
# File 'lib/easy_mailchimp/logger.rb', line 3

def initialize(logger)
  @logger = logger
end

Instance Attribute Details

#loggerObject (readonly)

Returns the value of attribute logger.



7
8
9
# File 'lib/easy_mailchimp/logger.rb', line 7

def logger
  @logger
end

Instance Method Details

#info(message, tag = nil) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/easy_mailchimp/logger.rb', line 9

def info(message, tag = nil)
  if defined?(::Rails) && defined?(::ActiveSupport::Logger)
    if ::Rails.logger.class == ::ActiveSupport::Logger

      if tag.present?
        ::Rails.logger.tagged(tag) { ::Rails.logger.debug message }
      else
        ::Rails.logger.debug message
      end

      return

    end
  end

  logger.debug message
end