Sha256: c1dc77e985fba77983356753e5698a5496a2f71b2050a54e9d5c15ce0b46a26c
Contents?: true
Size: 855 Bytes
Versions: 2
Compression:
Stored size: 855 Bytes
Contents
require 'contextualized_logs' require 'json' module ContextualizedLogs configure do |config| config.log_formatter = proc do |severity, timestamp, progname, msg| log = ContextualizedLogger.default_formatter.call(severity, timestamp, progname, msg) log = JSON.parse(log) # set log <> APM trace correlation datadog_correlation = Datadog.tracer.active_correlation log.merge!( dd: { trace_id: datadog_correlation.trace_id, span_id: datadog_correlation.span_id }, ddsource: ['ruby'] ) log.to_json + "\n" # for local debug, dump log in JSON pretty format # JSON.pretty_generate(log) + "\n" end config.controller_default_contextualizer = proc do |controller| ContextualizedController.default_contextualize_request(controller) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
contextualized_logs-0.0.4.pre.alpha | config/initializers/contextualized_logs.rb |
contextualized_logs-0.0.3.pre.alpha | config/initializers/contextualized_logs.rb |