Sha256: c5f105a379724e90fd91436ed33deb6450687ebf02efea64a926873f6fc17d5c
Contents?: true
Size: 1.51 KB
Versions: 23
Compression:
Stored size: 1.51 KB
Contents
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
23 entries across 23 versions & 1 rubygems