Sha256: cb72a1987a59b7092ca0c9979e9f29a84049d85d6076f40738adfaf2c3ae5500
Contents?: true
Size: 1.54 KB
Versions: 4
Compression:
Stored size: 1.54 KB
Contents
require "timber/integrator" module Timber module Integrations module Rails # 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: https://github.com/rails/rails/blob/80e66cc4d90bf8c15d1a5f6e3152e90147f00772/railties/lib/rails/rack/logger.rb#L34 # # @private class RackLogger < Integrator # @private module InstanceMethods LOGGER = ::Logger.new(nil) def self.included(klass) klass.class_eval do private # Rails 3.2 calls Rails.logger directly, so this is the first place # we can mute the logger calls. def started_request_message(*args) "" end # Rails > 3.2 uses a logger method. Muting logs is accomplished by # passing a dummy logger instance with a nil log device. def logger LOGGER end end end end def initialize require "rails/rack/logger" rescue LoadError => e raise RequirementNotMetError.new(e.message) end def integrate! return true if ::Rails::Rack::Logger.include?(InstanceMethods) ::Rails::Rack::Logger.send(:include, InstanceMethods) end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems