A boolean processor that returns true if and only if all its child processors return true. This version does not short-circuit the processing, so all children are always called even if an early one returns false. Thus, this processor is also a good one to use as a multiplexor to simply run a bunch of processors.
For example, this builds a processor that sends formatted log entries to STDOUT only if their level is at least INFO AND the progname is “rails”:
processor = Sawmill::EntryProcessor.build do If(All(FilterByBasicFields(:level => :INFO), FilterByBasicFields(:progname => 'rails')), Format(STDOUT)) end
This processor just formats both to STDOUT and STDERR:
processor = Sawmill::EntryProcessor.build do All(Format(STDOUT), Format(STDERR)) end
Create an “all” boolean. The parameters are child processors whose return values should be combined with an AND operation.
# File lib/sawmill/entry_processor/conditionals.rb, line 335 def initialize(*children_) @children = _interpret_processor_array(children_) end
# File lib/sawmill/entry_processor/conditionals.rb, line 357 def attribute(entry_) @children.inject(true) do |result_, child_| child_.attribute(entry_) && result_ end end
# File lib/sawmill/entry_processor/conditionals.rb, line 339 def begin_record(entry_) @children.inject(true) do |result_, child_| child_.begin_record(entry_) && result_ end end
# File lib/sawmill/entry_processor/conditionals.rb, line 345 def end_record(entry_) @children.inject(true) do |result_, child_| child_.end_record(entry_) && result_ end end
# File lib/sawmill/entry_processor/conditionals.rb, line 369 def finish Util::ProcessorTools.collect_finish_values(@children) end
# File lib/sawmill/entry_processor/conditionals.rb, line 351 def message(entry_) @children.inject(true) do |result_, child_| child_.message(entry_) && result_ end end
# File lib/sawmill/entry_processor/conditionals.rb, line 363 def unknown_data(entry_) @children.inject(true) do |result_, child_| child_.unknown_data(entry_) && result_ end end