Module: NewRelic::Agent::LocalLogDecorator

Extended by:
LocalLogDecorator
Included in:
LocalLogDecorator
Defined in:
lib/new_relic/agent/local_log_decorator.rb

Overview

This module contains helper methods related to decorating log messages

Instance Method Summary collapse

Instance Method Details

#decorate(message) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/new_relic/agent/local_log_decorator.rb', line 11

def decorate(message)
  return message unless decorating_enabled?

   = NewRelic::Agent.

  if message.is_a?(Hash)
    message.merge!() unless message.frozen?
    return
  end

   = " NR-LINKING|#{[ENTITY_GUID_KEY]}|#{[HOSTNAME_KEY]}|" \
                       "#{[TRACE_ID_KEY]}|#{[SPAN_ID_KEY]}|" \
                       "#{escape_entity_name([ENTITY_NAME_KEY])}|"

  message.partition("\n").insert(1, ).join
end