Class: Logtail::Integrations::Rails::RackLogger

Inherits:
Integrator
  • Object
show all
Defined in:
lib/logtail-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.



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

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

Instance Method Details

#integrate!Object



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

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

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