Class: Fluent::SayOutput

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

Instance Method Summary collapse

Instance Method Details

#configure(conf) ⇒ Object



5
6
7
8
# File 'lib/fluent/plugin/out_say.rb', line 5

def configure(conf)
  @field = conf['field'] || 'message'
  @voice = conf['voice']
end

#emit(tag, es, chain) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/fluent/plugin/out_say.rb', line 10

def emit(tag, es, chain)
  es.each{|time,record|
    message = record[@field]
    @voice = record['voice'] if record['voice']
    next unless message
    args = [ message.to_s ]
    args.push("-v#{@voice}") if @voice
    system('say', *args)
  }
  chain.next
end