Class: Fluent::ChatworkOutput
- Inherits:
-
Output
- Object
- Output
- Fluent::ChatworkOutput
- Defined in:
- lib/fluent/plugin/out_chatwork.rb
Instance Method Summary collapse
-
#configure(conf) ⇒ Object
This method is called before starting.
-
#emit(tag, es, chain) ⇒ Object
This method is called when an event reaches Fluentd.
- #generate_message(args = {}) ⇒ Object
- #post_message(args = {}) ⇒ Object
-
#shutdown ⇒ Object
This method is called when shutting down.
-
#start ⇒ Object
This method is called when starting.
Instance Method Details
#configure(conf) ⇒ Object
This method is called before starting.
15 16 17 |
# File 'lib/fluent/plugin/out_chatwork.rb', line 15 def configure(conf) super end |
#emit(tag, es, chain) ⇒ Object
This method is called when an event reaches Fluentd. ‘es’ is a Fluent::EventStream object that includes multiple events. You can use ‘es.each {|time,record| … }’ to retrieve events. ‘chain’ is an object that manages transactions. Call ‘chain.next’ at appropriate points and rollback if it raises an exception.
34 35 36 37 38 39 |
# File 'lib/fluent/plugin/out_chatwork.rb', line 34 def emit(tag, es, chain) chain.next es.each {|time,record| (time: time, record: record, tag: tag) } end |
#generate_message(args = {}) ⇒ Object
47 48 49 50 51 52 53 |
# File 'lib/fluent/plugin/out_chatwork.rb', line 47 def (args={}) time = args[:time] record = args[:record] tag = args[:tag] ERB.new().result(binding).gsub("\\n", "\n") end |
#post_message(args = {}) ⇒ Object
41 42 43 44 45 |
# File 'lib/fluent/plugin/out_chatwork.rb', line 41 def (args={}) body = (args) ChatWork.api_key = @api_token ChatWork::Message.create(room_id: @room_id, body: body) end |
#shutdown ⇒ Object
This method is called when shutting down.
25 26 27 |
# File 'lib/fluent/plugin/out_chatwork.rb', line 25 def shutdown super end |
#start ⇒ Object
This method is called when starting.
20 21 22 |
# File 'lib/fluent/plugin/out_chatwork.rb', line 20 def start super end |