Module: Datadog::CI::Contrib::ActiveSupport::LogsFormatter
- Defined in:
- lib/datadog/ci/contrib/activesupport/logs_formatter.rb
Instance Method Summary collapse
- #call(severity, timestamp, progname, msg) ⇒ Object
- #datadog_configuration ⇒ Object
- #datadog_logs_component ⇒ Object
Instance Method Details
#call(severity, timestamp, progname, msg) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/datadog/ci/contrib/activesupport/logs_formatter.rb', line 8 def call(severity, , progname, msg) # don't even construct an object for every log message if agentless logs submission is not enabled return super unless datadog_logs_component.enabled return super unless datadog_configuration[:enabled] # additional precaution because we cannot use targeted prepend in Ruby 2.7, so method :tags_text might # not be available (highly unlikely, but not unimaginable) # # (see Datadog::CI::Contrib::ActiveSupport::Patcher for explanation) return super unless respond_to?(:tags_text) = "#{msg} #{}" return super unless .include?("dd.trace_id") datadog_logs_component.write({ message: , level: severity }) super end |
#datadog_configuration ⇒ Object
34 35 36 |
# File 'lib/datadog/ci/contrib/activesupport/logs_formatter.rb', line 34 def datadog_configuration Datadog.configuration.ci[:activesupport] end |
#datadog_logs_component ⇒ Object
30 31 32 |
# File 'lib/datadog/ci/contrib/activesupport/logs_formatter.rb', line 30 def datadog_logs_component Datadog.send(:components).agentless_logs_submission end |