Module: SemanticLogger::Logger::Chain

Defined in:
lib/new_relic/agent/instrumentation/semantic_logger/chain.rb

Class Method Summary collapse

Class Method Details

.instrument!Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/new_relic/agent/instrumentation/semantic_logger/chain.rb', line 9

def self.instrument!
  ::SemanticLogger::Logger.class_eval do
    include NewRelic::Agent::Instrumentation::SemanticLogger::Logger

    alias_method(:log_without_new_relic, :log)

    def log(log, *args)
      return log_without_new_relic(log, *args) unless log.is_a?(::SemanticLogger::Log)

      log_with_new_relic(log) do
        log_without_new_relic(log)
      end
    end
  end
end