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 records to STDOUT only if they have a “user” attribute of “daniel” AND their record ID is ‘12345678’:
processor = Sawmill::RecordProcessor.build do If(All(FilterByAttributes('user' => 'daniel'), FilterByRecordID('12345678')), Format(STDOUT)) end
This processor just formats both to STDOUT and STDERR:
processor = Sawmill::RecordProcessor.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/record_processor/conditionals.rb, line 257 def initialize(*children_) @children = _interpret_processor_array(children_) end
# File lib/sawmill/record_processor/conditionals.rb, line 267 def extra_entry(entry_) @children.inject(true) do |result_, child_| child_.extra_entry(entry_) && result_ end end
# File lib/sawmill/record_processor/conditionals.rb, line 273 def finish Util::ProcessorTools.collect_finish_values(@children) end
# File lib/sawmill/record_processor/conditionals.rb, line 261 def record(record_) @children.inject(true) do |result_, child_| child_.record(record_) && result_ end end