Skip to content

Commit be06779

Browse files
committed
Support Rails 6.1
1 parent be2d80c commit be06779

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/rails_semantic_logger/engine.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
require "rails"
22
require "action_controller/log_subscriber"
3+
require "action_view/log_subscriber"
34
require "rails_semantic_logger/options"
45

56
module RailsSemanticLogger
@@ -147,14 +148,22 @@ class Engine < ::Rails::Engine
147148

148149
if config.rails_semantic_logger.semantic
149150
# Active Job
150-
if defined?(::ActiveJob)
151+
if defined?(::ActiveJob) && defined?(::ActiveJob::Logging::LogSubscriber)
151152
RailsSemanticLogger.swap_subscriber(
152153
::ActiveJob::Logging::LogSubscriber,
153154
RailsSemanticLogger::ActiveJob::LogSubscriber,
154155
:active_job
155156
)
156157
end
157158

159+
if defined?(::ActiveJob) && defined?(::ActiveJob::LogSubscriber)
160+
RailsSemanticLogger.swap_subscriber(
161+
::ActiveJob::LogSubscriber,
162+
RailsSemanticLogger::ActiveJob::LogSubscriber,
163+
:active_job
164+
)
165+
end
166+
158167
# Active Record
159168
if defined?(::ActiveRecord)
160169
require "active_record/log_subscriber"

0 commit comments

Comments
 (0)