Sha256: c7ab408e9e0c65db81925ef774fb06292426f12bee07a7a24749f16fd3334d79
Contents?: true
Size: 456 Bytes
Versions: 1
Compression:
Stored size: 456 Bytes
Contents
class LogStashLogger::TCPClient def initialize(host, port) @host = host @port = port end def write(event) begin connect unless @socket @socket.write("#{event.to_hash.to_json}\n") rescue => e warn "LogStashLogger::TCPClient - #{e.class} - #{e.message}" @socket && @socket.close rescue nil @socket = nil end end private def connect @socket = TCPSocket.new(@host, @port) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
logstash-logger-0.1.0 | lib/logstash-logger/tcp_client.rb |