Class: GELF::Transport::TCP
- Inherits:
-
Object
- Object
- GELF::Transport::TCP
- Defined in:
- lib/gelf/transport/tcp.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#addresses ⇒ Object
Returns the value of attribute addresses.
Instance Method Summary collapse
-
#initialize(addresses) ⇒ TCP
constructor
‘addresses` Array of [host, port] pairs.
- #send(message) ⇒ Object
Constructor Details
#initialize(addresses) ⇒ TCP
‘addresses` Array of [host, port] pairs
7 8 9 10 |
# File 'lib/gelf/transport/tcp.rb', line 7 def initialize(addresses) @sockets = [] self.addresses = addresses end |
Instance Attribute Details
#addresses ⇒ Object
Returns the value of attribute addresses.
4 5 6 |
# File 'lib/gelf/transport/tcp.rb', line 4 def addresses @addresses end |
Instance Method Details
#send(message) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/gelf/transport/tcp.rb', line 19 def send() return if @addresses.empty? loop do connected = @sockets.reject(&:closed?) reconnect_all if connected.empty? break if write_any(connected, ) end end |