Module: RackSilence

Defined in:
lib/rack_silence.rb

Overview

Rack middleware that allows silencing select requests by path or header. Token can be set to prevent arbitrary people from silencing logs.

Example ‘config/initializers/rack_silence.rb` for Rails:

# inject rack logger in Application class:
Rails.application.config
.middleware.insert_before(Rails::Rack::Logger, RackSilence::Logger,
                          silenced: [RackSilence.token("decafbad"),
                                     '/noisy/action.json',
                                     %r{^/uninteresting/[0-9]+}])

Defined Under Namespace

Classes: Logger, Token

Class Method Summary collapse

Class Method Details

.token(value) ⇒ Object

Convenience function to create a token



90
91
92
# File 'lib/rack_silence.rb', line 90

def self.token(value)
  Token.new(value)
end