Class: FlumeLogger::Eventserver
- Inherits:
-
Object
- Object
- FlumeLogger::Eventserver
- Defined in:
- lib/flume-logger/eventserver.rb
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(host = "localhost", port = 9090, flume_type = :ng) ⇒ Eventserver
constructor
A new instance of Eventserver.
- #write(event) ⇒ Object
Constructor Details
#initialize(host = "localhost", port = 9090, flume_type = :ng) ⇒ Eventserver
Returns a new instance of Eventserver.
2 3 4 5 6 7 |
# File 'lib/flume-logger/eventserver.rb', line 2 def initialize(host="localhost", port=9090, flume_type=:ng) @host = host @port = port @client = nil @type = flume_type end |
Instance Method Details
#close ⇒ Object
22 23 24 25 26 |
# File 'lib/flume-logger/eventserver.rb', line 22 def close @client && @transport.close() rescue => e warn "#{self.class} - #{e.class} - #{e.}" end |
#write(event) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/flume-logger/eventserver.rb', line 9 def write(event) begin connect unless @client @client.append(event) rescue => e warn "#{self.class} - #{e.class} - #{e.}: #{event}" close @client = nil raise end end |