Class: Timber::Integrations::ActionView::LogSubscriber

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

Overview

Reponsible for uninstalling the default ‘ActionView::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_view/log_subscriber.rb', line 9

def initialize
  require "action_view/log_subscriber"
  require "timber-rails/action_view/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_view/log_subscriber.rb', line 16

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

  Timber::Integrations::Rails::ActiveSupportLogSubscriber.unsubscribe!(:action_view, ::ActionView::LogSubscriber)
  TimberLogSubscriber.attach_to(:action_view)
end