module Sawmill::EntryProcessor

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

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

Sawmill’s basic entry 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 entry processor that lives in the Sawmill::EntryProcessor module and subclasses Sawmill::EntryProcessor::Base can be instantiated by using its name as a function call. Other processors may also add themselves to the DSL by calling Sawmill::EntryProcessor::Base#add_dsl_method.

For example:

Sawmill::EntryProcessor.build do
  If(FilterByBasicFields(:level => :WARN), Format(STDOUT))
end
# File lib/sawmill/entry_processor.rb, line 213
def self.build(&block_)
  ::Blockenspiel.invoke(block_, Builder.new)
end