Class: Airbrake::Filters::KeysWhitelist

Inherits:
Object
  • Object
show all
Includes:
KeysFilter
Defined in:
lib/airbrake-ruby/filters/keys_whitelist.rb

Overview

A default Airbrake notice filter. Filters everything in the modifiable payload of a notice, but specified keys.

Examples:

filter = Airbrake::Filters::KeysWhitelist.new(:email, /user/i, 'account_id')
airbrake.add_filter(filter)
airbrake.notify(StandardError.new('App crashed!'), {
  user: 'John',
  password: 's3kr3t',
  email: '[email protected]',
  account_id: 42
})

# The dashboard will display this parameters as filtered, but other
# values won't be affected:
#   { user: 'John',
#     password: '[Filtered]',
#     email: '[email protected]',
#     account_id: 42 }

See Also:

Instance Method Summary collapse

Methods included from KeysFilter

#call, #initialize

Instance Method Details

#should_filter?(key) ⇒ Boolean



32
33
34
# File 'lib/airbrake-ruby/filters/keys_whitelist.rb', line 32

def should_filter?(key)
  @patterns.none? { |pattern| key.to_s.match(pattern) }
end