Skip to content

Commit

Permalink
Change lograge log to warn
Browse files Browse the repository at this point in the history
  • Loading branch information
TonyCTHsu committed Sep 10, 2024
1 parent 6faaf2d commit d5017d4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions lib/datadog/tracing/contrib/lograge/patcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ def patch
if defined?(::ActiveSupport::TaggedLogging::Formatter) &&
::Lograge::LogSubscribers::ActionController
.logger&.formatter.is_a?(::ActiveSupport::TaggedLogging::Formatter)

Datadog.logger.error(
Datadog.logger.warn(
'Lograge and ActiveSupport::TaggedLogging (the default Rails log formatter) are not compatible: ' \
'Lograge does not account for Rails log tags, creating polluted logs and breaking log formatting. ' \
'Traces and Logs correlation may not work. ' \
Expand Down
4 changes: 2 additions & 2 deletions spec/datadog/tracing/contrib/lograge/patcher_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

context 'without Rails tagged logging' do
it 'does not log incompatibility error' do
expect(Datadog.logger).to_not receive(:error)
expect(Datadog.logger).to_not receive(:warn)

described_class.patch
end
Expand All @@ -26,7 +26,7 @@
logger = ActiveSupport::TaggedLogging.new(Logger.new(File::NULL))
stub_const('Lograge::LogSubscribers::ActionController', double('controller', logger: logger))

expect(Datadog.logger).to receive(:error).with(/ActiveSupport::TaggedLogging/)
expect(Datadog.logger).to receive(:warn).with(/ActiveSupport::TaggedLogging/)

described_class.patch
end
Expand Down

0 comments on commit d5017d4

Please sign in to comment.