Sha256: 6e8c0d3e62bea68179d93e54beaad1373ed240fb4e6293556a01f2d06b63b210

Contents?: true

Size: 791 Bytes

Versions: 1

Compression:

Stored size: 791 Bytes

Contents

module Datadog
  module Tracing
    module Contrib
      # Instrument Rails.
      module Rails
        # Rails log injection helper methods
        module LogInjection
          module_function

          # Use `app.config.log_tags` to inject propagation tags into the default Rails logger.
          def configure_log_tags(app)
            app.config.log_tags ||= [] # Can be nil, we initialized it if so
            app.config.log_tags << proc { Tracing.log_correlation if Datadog.configuration.tracing.log_injection }
          rescue StandardError => e
            Datadog.logger.warn(
              "Unable to add Datadog Trace context to ActiveSupport::TaggedLogging: #{e.class.name} #{e.message}"
            )
            false
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ddtrace-1.13.0 lib/datadog/tracing/contrib/rails/log_injection.rb