Skip to content

Commit c368ffa

Browse files
committed
add more conditions
1 parent 31014dc commit c368ffa

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

lib/rails_semantic_logger/engine.rb

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -193,19 +193,23 @@ class Engine < ::Rails::Engine
193193
:action_view
194194
)
195195

196-
# Action Controller
197-
RailsSemanticLogger.swap_subscriber(
198-
::ActionController::LogSubscriber,
199-
RailsSemanticLogger::ActionController::LogSubscriber,
200-
:action_controller
201-
)
196+
if defined?(::ActionController)
197+
# Action Controller
198+
RailsSemanticLogger.swap_subscriber(
199+
::ActionController::LogSubscriber,
200+
RailsSemanticLogger::ActionController::LogSubscriber,
201+
:action_controller
202+
)
203+
end
202204

203-
# Action Mailer
204-
RailsSemanticLogger.swap_subscriber(
205-
::ActionMailer::LogSubscriber,
206-
RailsSemanticLogger::ActionMailer::LogSubscriber,
207-
:action_mailer
208-
)
205+
if defined?(::ActionMailer)
206+
# Action Mailer
207+
RailsSemanticLogger.swap_subscriber(
208+
::ActionMailer::LogSubscriber,
209+
RailsSemanticLogger::ActionMailer::LogSubscriber,
210+
:action_mailer
211+
)
212+
end
209213
end
210214

211215
#

0 commit comments

Comments
 (0)