Module: NewRelic::Agent::Instrumentation::Logging::Logger
- Included in:
- Logging::Logger::Prepend
- Defined in:
- lib/new_relic/agent/instrumentation/logging/instrumentation.rb
Constant Summary collapse
- INSTRUMENTATION_NAME =
'Logging'
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.enabled? ⇒ Boolean
10 11 12 |
# File 'lib/new_relic/agent/instrumentation/logging/instrumentation.rb', line 10 def self.enabled? NewRelic::Agent.config[:'instrumentation.logging'] != 'disabled' end |
Instance Method Details
#log_event_with_new_relic(event) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/new_relic/agent/instrumentation/logging/instrumentation.rb', line 14 def log_event_with_new_relic(event) # If sending to multiple loggers, decorate each log event.data = NewRelic::Agent::LocalLogDecorator.decorate(event.data) # Prevents duplicate NR events when the same log goes through multiple loggers if event.logger == @name begin mdc_data = capture_mdc_data NewRelic::Agent.record_instrumentation_invocation(INSTRUMENTATION_NAME) NewRelic::Agent.agent.log_event_aggregator.record_logging_event(event, mdc_data) rescue => e NewRelic::Agent.logger.debug("Failed to capture Logging event: #{e.message}") end end yield if block_given? end |