module Sawmill::RecordProcessor

Entry processors are objects that receive a stream of log records and perform some action. Some processors perform their own action, while others could filter records and forward them to other processors.

The API contract for a record processor is specified by the class Sawmill::RecordProcessor::Base. Processors could subclass that base class, or could just duck-type the methods.

Sawmill’s basic record processor classes live into this module’s namespace, but this is not a requirement for your own processors.

Public Class Methods

build(&block_) click to toggle source

A convenience DSL for building sets of processors. This is typically useful for constructing if-expressions using the boolean operation processors.

Every record processor that lives in the Sawmill::RecordProcessor module and subclasses Sawmill::RecordProcessor::Base can be instantiated by using its name as a function call. Other processors may also add themselves to the DSL by calling Sawmill::RecordProcessor::Base#add_dsl_method.

For example:

Sawmill::RecordProcessor.build do
  If(Or(FilterByRecordId('12345678'), FilterByRecordId('abcdefg')),
     Format(STDOUT))
end
# File lib/sawmill/record_processor.rb, line 193
def self.build(&block_)
  ::Blockenspiel.invoke(block_, Builder.new)
end