Module: SolidObjects::LogSubscriber
- Defined in:
- lib/solid_objects/log_subscriber.rb,
sig/generated/lib/solid_objects/log_subscriber.rbs
Class Method Summary collapse
Class Method Details
.install ⇒ void
This method returns an undefined value.
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/solid_objects/log_subscriber.rb', line 7 def install return if @subscription @subscription = ActiveSupport::Notifications.subscribe(/\Asolid_objects\./) do |event| SolidObjects.configuration.logger.info( { event: event.name, duration_ms: event.duration.round(2) }.merge(event.payload) ) end end |
.uninstall ⇒ void
This method returns an undefined value.
21 22 23 24 25 26 |
# File 'lib/solid_objects/log_subscriber.rb', line 21 def uninstall return unless @subscription ActiveSupport::Notifications.unsubscribe(@subscription) @subscription = nil end |