Class: Sentry::Rails::LogSubscriber
- Inherits:
-
ActiveSupport::LogSubscriber
- Object
- ActiveSupport::LogSubscriber
- Sentry::Rails::LogSubscriber
- Defined in:
- lib/sentry/rails/log_subscriber.rb
Overview
Base class for Sentry log subscribers that extends ActiveSupport::LogSubscriber to provide structured logging capabilities for Rails components.
This class follows Rails’ LogSubscriber pattern and provides common functionality for capturing Rails instrumentation events and logging them through Sentry’s structured logging system.
Direct Known Subclasses
Sentry::Rails::LogSubscribers::ActionControllerSubscriber, Sentry::Rails::LogSubscribers::ActionMailerSubscriber, Sentry::Rails::LogSubscribers::ActiveJobSubscriber, Sentry::Rails::LogSubscribers::ActiveRecordSubscriber
Constant Summary collapse
- ORIGIN =
"auto.logger.rails.log_subscriber"
Instance Method Summary collapse
-
#detach_from(namespace, notifications = ActiveSupport::Notifications) ⇒ Object
Rails 5.x does not provide detach_from.
Instance Method Details
#detach_from(namespace, notifications = ActiveSupport::Notifications) ⇒ Object
Rails 5.x does not provide detach_from
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/sentry/rails/log_subscriber.rb', line 35 def detach_from(namespace, notifications = ActiveSupport::Notifications) listeners = public_instance_methods(false) .flat_map { |key| notifications.notifier.listeners_for("#{key}.#{namespace}") } .select { |listener| listener.instance_variable_get(:@delegate).is_a?(self) } listeners.map do |listener| notifications.notifier.unsubscribe(listener) end end |