Sha256: 3c2757a88120389139070e8808babce4bb1a497ab05ef01b4c0662576ded0aa9
Contents?: true
Size: 1.79 KB
Versions: 27
Compression:
Stored size: 1.79 KB
Contents
require_relative 'helper' require 'fluent/input' require 'fluent/output' require 'fluent/filter' module FluentTest class FluentTestInput < ::Fluent::Input ::Fluent::Plugin.register_input('test_in', self) attr_reader :started def start @started = true end def shutdown @started = false end end class FluentTestOutput < ::Fluent::Output ::Fluent::Plugin.register_output('test_out', self) def initialize super @events = Hash.new { |h, k| h[k] = [] } end attr_reader :events attr_reader :started def start @started = true end def shutdown @started = false end def emit(tag, es, chain) es.each { |time, record| @events[tag] << record } end end class FluentTestErrorOutput < ::Fluent::BufferedOutput ::Fluent::Plugin.register_output('test_out_error', self) def format(tag, time, record) raise "emit error!" end def write(chunk) raise "chunk error!" end end class FluentTestFilter < ::Fluent::Filter ::Fluent::Plugin.register_filter('test_filter', self) def initialize(field = '__test__') super() @num = 0 @field = field end attr_reader :num attr_reader :started def start @started = true end def shutdown @started = false end def filter(tag, time, record) record[@field] = @num @num += 1 record end end class TestEmitErrorHandler def initialize @events = Hash.new { |h, k| h[k] = [] } end attr_reader :events def handle_emit_error(tag, time, record, error) @events[tag] << record end def handle_emits_error(tag, es, error) es.each { |time,record| handle_emit_error(tag, time, record, error) } end end end
Version data entries
27 entries across 27 versions & 2 rubygems