A basic filter that knows how to check level and progname.
This is a boolean processor, so it merely returns true or false based on the filter result. Use this in conjunction with an If processor to actually perform other actions based on the result.
Create a new filter.
Recognized options include:
:level
Lowest level that will be accepted. This should be either a Sawmill::Level object or an integer value or string/symbol that represents a level. If set to nil or not specified, this filter does not check the level.
:progname
Progname filter. This can be either a string or a Regexp. If set to nil or not specified, this filter does not check the progname.
:accept_record_delimiters
If set to true, accepts all #begin_record and #end_record entries regardless of the level or progname. If set to false, accepts no such entries. Otherwise, if not specified, those entries are subject to the usual level and progname filters.
:accept_attributes
If set to true, accepts all attribute and multi_attribute entries regardless of the level or progname. If set to false, accepts no such entries. Otherwise, if not specified, those entries are subject to the usual level and progname filters.
:accept_incomparable_levels
If set to true, accepts entries whose level is not
comparable to the given :level
setting. Otherwise, rejects all
such entries.
:accept_unknown
If set to true, accepts all entries of type :unknown_data. Otherwise, rejects all such entries.
# File lib/sawmill/entry_processor/filter_by_basic_fields.rb, line 81 def initialize(opts_={}) @level = opts_[:level] @progname = opts_[:progname] @accept_record_delimiters = opts_[:accept_record_delimiters] @accept_attributes = opts_[:accept_attributes] @accept_incomparable_levels = opts_[:accept_incomparable_levels] @accept_unknown = opts_[:accept_unknown] end
# File lib/sawmill/entry_processor/filter_by_basic_fields.rb, line 103 def attribute(entry_) @accept_attributes.nil? ? _check_filter(entry_) : @accept_attributes end
# File lib/sawmill/entry_processor/filter_by_basic_fields.rb, line 91 def begin_record(entry_) @accept_record_delimiters.nil? ? _check_filter(entry_) : @accept_record_delimiters end
# File lib/sawmill/entry_processor/filter_by_basic_fields.rb, line 95 def end_record(entry_) @accept_record_delimiters.nil? ? _check_filter(entry_) : @accept_record_delimiters end
# File lib/sawmill/entry_processor/filter_by_basic_fields.rb, line 111 def finish nil end
# File lib/sawmill/entry_processor/filter_by_basic_fields.rb, line 99 def message(entry_) _check_filter(entry_) end
# File lib/sawmill/entry_processor/filter_by_basic_fields.rb, line 107 def unknown_data(entry_) @accept_unknown end