Class: Fluent::ToSOutput

Inherits:
Output
  • Object
show all
Defined in:
lib/fluent/plugin/out_to_s.rb

Instance Method Summary collapse

Instance Method Details

#configure(conf) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/fluent/plugin/out_to_s.rb', line 7

def configure(conf)
  super

  @prefix = "#{@tag_prefix}."
  @tag_proc =
    if !@tag_prefix.empty?
      Proc.new {|tag| "#{@prefix}#{tag}"}
    else
      Proc.new {|tag| tag}
    end
  @to_s =
    Proc.new {|record| record.to_s}
end

#emit(tag, es, chain) ⇒ Object



21
22
23
24
25
26
27
28
29
30
# File 'lib/fluent/plugin/out_to_s.rb', line 21

def emit(tag, es, chain)
  emit_tag = @tag_proc.call(tag)

  es.each do |time, record|
    record[@field_name] = record.to_s
    Fluent::Engine.emit(emit_tag, time, record)
  end

  chain.next
end