class Sawmill::EntryProcessor::FilterByBasicFields

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.

Public Class Methods

new(opts_={}) click to toggle source

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

Public Instance Methods

attribute(entry_) click to toggle source
# File lib/sawmill/entry_processor/filter_by_basic_fields.rb, line 103
def attribute(entry_)
  @accept_attributes.nil? ? _check_filter(entry_) : @accept_attributes
end
begin_record(entry_) click to toggle source
# 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
end_record(entry_) click to toggle source
# 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
finish() click to toggle source
# File lib/sawmill/entry_processor/filter_by_basic_fields.rb, line 111
def finish
  nil
end
message(entry_) click to toggle source
# File lib/sawmill/entry_processor/filter_by_basic_fields.rb, line 99
def message(entry_)
  _check_filter(entry_)
end
unknown_data(entry_) click to toggle source
# File lib/sawmill/entry_processor/filter_by_basic_fields.rb, line 107
def unknown_data(entry_)
  @accept_unknown
end