Module: Timber::Overrides::ActiveSupportTaggedLogging::FormatterMethods

Defined in:
lib/timber-rails/overrides/active_support_tagged_logging.rb

Class Method Summary collapse

Class Method Details

.included(mod) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/timber-rails/overrides/active_support_tagged_logging.rb', line 14

def self.included(mod)
  mod.module_eval do
    alias_method :_timber_original_push_tags, :push_tags
    alias_method :_timber_original_pop_tags, :pop_tags

    def call(severity, timestamp, progname, msg)
      if is_a?(Timber::Logger::Formatter)
        # Don't convert the message into a string
        super(severity, timestamp, progname, msg)
      else
        super(severity, timestamp, progname, "#{tags_text}#{msg}")
      end
    end
  end
end