Class: Timber::Integrations::Rails::RackLogger

Inherits:
Integrator
  • Object
show all
Defined in:
lib/timber-rails/rack_logger.rb

Overview

Disables the default rail’s rack logging. Note, we cannot simply uninstall this rack middleware because rails couples this with ActiveSupport instrumentation. As such, we simply disable the logger and let our Rack middleware handle the logging.

See: github.com/rails/rails/blob/80e66cc4d90bf8c15d1a5f6e3152e90147f00772/railties/lib/rails/rack/logger.rb#L34

Defined Under Namespace

Modules: InstanceMethods

Instance Method Summary collapse

Constructor Details

#initializeRackLogger

Returns a new instance of RackLogger.



44
45
46
47
48
# File 'lib/timber-rails/rack_logger.rb', line 44

def initialize
  require "rails/rack/logger"
rescue LoadError => e
  raise RequirementNotMetError.new(e.message)
end

Instance Method Details

#integrate!Object



50
51
52
53
54
# File 'lib/timber-rails/rack_logger.rb', line 50

def integrate!
  return true if ::Rails::Rack::Logger.include?(InstanceMethods)

  ::Rails::Rack::Logger.send(:include, InstanceMethods)
end