Class: Bosh::Common::Logging::RegexFilter
- Inherits:
-
Logging::Filter
- Object
- Logging::Filter
- Bosh::Common::Logging::RegexFilter
- Defined in:
- lib/common/logging/regex_filter.rb
Instance Method Summary collapse
- #allow(event) ⇒ Object
-
#initialize(filters) ⇒ RegexFilter
constructor
A new instance of RegexFilter.
Constructor Details
#initialize(filters) ⇒ RegexFilter
Returns a new instance of RegexFilter.
7 8 9 |
# File 'lib/common/logging/regex_filter.rb', line 7 def initialize(filters) @filters = filters end |
Instance Method Details
#allow(event) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/common/logging/regex_filter.rb', line 11 def allow(event) @filters.each do |hash| match_pattern, replacement_pattern = hash.first if replacement_pattern.nil? return nil if match_pattern.match?(event.data) else event.data = event.data.gsub(match_pattern, replacement_pattern) end end event end |