Class: Timber::Integrations::ActionController::LogSubscriber

Inherits:
Integrator
  • Object
show all
Defined in:
lib/timber-rails/action_controller/log_subscriber.rb,
lib/timber-rails/action_controller/log_subscriber/timber_log_subscriber.rb

Overview

Responsible for removing the default ActionController::LogSubscriber and installing the TimberLogSubscriber

Defined Under Namespace

Classes: TimberLogSubscriber

Instance Method Summary collapse

Constructor Details

#initializeLogSubscriber

Returns a new instance of LogSubscriber.



9
10
11
12
13
14
# File 'lib/timber-rails/action_controller/log_subscriber.rb', line 9

def initialize
  require "action_controller/log_subscriber"
  require "timber-rails/action_controller/log_subscriber/timber_log_subscriber"
rescue LoadError => e
  raise RequirementNotMetError.new(e.message)
end

Instance Method Details

#integrate!Object



16
17
18
19
20
21
# File 'lib/timber-rails/action_controller/log_subscriber.rb', line 16

def integrate!
  return true if Timber::Integrations::Rails::ActiveSupportLogSubscriber.subscribed?(:action_controller, TimberLogSubscriber)

  Timber::Integrations::Rails::ActiveSupportLogSubscriber.unsubscribe!(:action_controller, ::ActionController::LogSubscriber)
  TimberLogSubscriber.attach_to(:action_controller)
end