Class: LogStash::Outputs::LogmaticTcp::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/logstash/outputs/logmatic.rb

Instance Method Summary collapse

Constructor Details

#initialize(socket, logger) ⇒ Client

Returns a new instance of Client.



47
48
49
50
51
# File 'lib/logstash/outputs/logmatic.rb', line 47

def initialize(socket, logger)
  @socket = socket
  @logger = logger
  @queue  = Queue.new
end

Instance Method Details

#runObject



54
55
56
57
58
59
60
61
62
63
64
# File 'lib/logstash/outputs/logmatic.rb', line 54

def run
  loop do
    begin
      @socket.write(@queue.pop)
    rescue => e
      @logger.warn("tcp output exception", :socket => @socket,
                   :exception => e)
      break
    end
  end
end

#write(msg) ⇒ Object



67
68
69
# File 'lib/logstash/outputs/logmatic.rb', line 67

def write(msg)
  @queue.push(msg)
end