class Sawmill::EntryClassifier

An object that classifies log entry objects, calling the proper methods on a Sawmill::EntryProcessor.

Public Class Methods

new(processor_) click to toggle source

Create a classifier that sends entries to the given Sawmill::EntryProcessor.

# File lib/sawmill/entry_classifier.rb, line 49
def initialize(processor_)
  @processor = processor_
end

Public Instance Methods

entry(entry_) click to toggle source

Call this method to classify a log entry and send it to the processor.

# File lib/sawmill/entry_classifier.rb, line 56
def entry(entry_)
  case entry_.type
  when :unknown_data
    @processor.unknown_data(entry_)
  when :begin_record
    @processor.begin_record(entry_)
  when :end_record
    @processor.end_record(entry_)
  when :message
    @processor.message(entry_)
  when :attribute
    @processor.attribute(entry_)
  end
end