Class: Fluent::YoOutput

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

Instance Method Summary collapse

Constructor Details

#initializeYoOutput

Returns a new instance of YoOutput.



8
9
10
11
# File 'lib/fluent/plugin/out_yo.rb', line 8

def initialize
  super
  require 'yo'
end

Instance Method Details

#configure(conf) ⇒ Object

Raises:

  • (Fluent::ConfigError)


13
14
15
16
17
# File 'lib/fluent/plugin/out_yo.rb', line 13

def configure(conf)
  super
  raise Fluent::ConfigError, 'Visit http://yoapi.justyo.co/ and get an api key' if !@api_key or @api_key.empty?
  @yo = Yo.new(@api_key)
end

#emit(tag, es, chain) ⇒ Object



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

def emit(tag, es, chain)
  begin
    @yo.yo
  rescue => e
    raise Fluent::ConfigError, "Maybe Yo config is mistaken: #{e.class}, #{e.message}"
  end
  chain.next
end

#shutdownObject



20
# File 'lib/fluent/plugin/out_yo.rb', line 20

def shutdown; end

#startObject



19
# File 'lib/fluent/plugin/out_yo.rb', line 19

def start; end