Module: NewRelic::Agent::Instrumentation::SemanticLogger::Logger

Included in:
SemanticLogger::Logger::Prepend
Defined in:
lib/new_relic/agent/instrumentation/semantic_logger/instrumentation.rb

Defined Under Namespace

Modules: Chain, Prepend

Constant Summary collapse

INSTRUMENTATION_NAME =
'SemanticLogger'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.enabled?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/new_relic/agent/instrumentation/semantic_logger/instrumentation.rb', line 10

def self.enabled?
  NewRelic::Agent.config[:'instrumentation.semantic_logger'] != 'disabled'
end

Instance Method Details

#log_with_new_relic(log) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/new_relic/agent/instrumentation/semantic_logger/instrumentation.rb', line 14

def log_with_new_relic(log)
  NewRelic::Agent.record_instrumentation_invocation(INSTRUMENTATION_NAME)

  begin
    NewRelic::Agent.agent.log_event_aggregator.record_semantic_logger(log)
    log.message = NewRelic::Agent::LocalLogDecorator.decorate(log.message)
  rescue => e
    NewRelic::Agent.logger.debug("Failed to capture Semantic Logger event: #{e.message}")
  end

  yield if block_given?
end