Skip to content

Commit

Permalink
Use Rails.application.deprecators.silence for rails >= 7.1 (#58)
Browse files Browse the repository at this point in the history
Use Rails.application.deprecators.silence for rails >= 7.1
  • Loading branch information
Aqualon authored Sep 27, 2024
1 parent 1fdf41c commit f356fcf
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions lib/logjam_agent/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,21 @@ def log_error(request, wrapper)
trace = wrapper.application_trace
trace = wrapper.framework_trace if trace.empty?

ActiveSupport::Deprecation.silence do
parts = [ "#{exception.class} (#{exception.message})" ]
parts.concat exception.annoted_source_code if exception.respond_to?(:annoted_source_code)
parts.concat trace
logger.fatal parts.join("\n ")
if Gem::Version.new(Rails::VERSION::STRING) >= Gem::Version.new("7.1.0")
Rails.application.deprecators.silence do
parts = [ "#{exception.class} (#{exception.message})" ]
parts.concat exception.annoted_source_code if exception.respond_to?(:annoted_source_code)
parts.concat trace
logger.fatal parts.join("\n ")
end
else
ActiveSupport::Deprecation.silence do
parts = [ "#{exception.class} (#{exception.message})" ]
parts.concat exception.annoted_source_code if exception.respond_to?(:annoted_source_code)
parts.concat trace
logger.fatal parts.join("\n ")
end

end
end
end
Expand Down

0 comments on commit f356fcf

Please sign in to comment.