Skip to content

Instantly share code, notes, and snippets.

@makimoto
Created February 4, 2012 15:54
Show Gist options
  • Save makimoto/1738669 to your computer and use it in GitHub Desktop.
Save makimoto/1738669 to your computer and use it in GitHub Desktop.
module Fluent
class SayOutput < Output
Plugin.register_output('say', self)
def configure(conf)
@field = conf['field'] || 'message'
@voice = conf['voice']
end
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
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment