class Airbrake::Filters::KeysWhitelist
A default Airbrake
notice filter. Filters
everything in the payload of a notice, but specified keys.
@example
filter = Airbrake::Filters::KeysBlacklist.new( Logger.new(STDOUT), [:email, /credit/i, 'password'] ) airbrake.add_filter(filter) airbrake.notify(StandardError.new('App crashed!'), { user: 'John', password: 's3kr3t', email: 'john@example.com', account_id: 42 }) # The dashboard will display this parameters as filtered, but other # values won't be affected: # { user: 'John', # password: '[Filtered]', # email: 'john@example.com', # account_id: 42 }
@see KeysBlacklist
@see KeysFilter
Public Class Methods
new(*)
click to toggle source
Calls superclass method
Airbrake::Filters::KeysFilter::new
# File lib/airbrake-ruby/filters/keys_whitelist.rb, line 32 def initialize(*) super @weight = -100 end
Public Instance Methods
should_filter?(key)
click to toggle source
@return [Boolean] true if the key doesn't match any pattern, false
otherwise.
# File lib/airbrake-ruby/filters/keys_whitelist.rb, line 40 def should_filter?(key) @patterns.none? do |pattern| if pattern.is_a?(Regexp) key.match(pattern) else key.to_s == pattern.to_s end end end