Class: LogStashLogger::Device::Unix

Inherits:
Connectable show all
Defined in:
lib/logstash-logger/device/unix.rb

Instance Attribute Summary

Attributes inherited from Base

#io, #sync

Instance Method Summary collapse

Methods inherited from Connectable

#close, #connected?, #flush, #reconnect, #to_io, #with_connection, #write, #write_batch

Methods inherited from Base

#close, #flush, #to_io, #write

Constructor Details

#initialize(opts = {}) ⇒ Unix

Returns a new instance of Unix.



6
7
8
9
# File 'lib/logstash-logger/device/unix.rb', line 6

def initialize(opts={})
  super
  @path = opts[:path] || fail(ArgumentError, "Path is required")
end

Instance Method Details

#connectObject



11
12
13
14
15
# File 'lib/logstash-logger/device/unix.rb', line 11

def connect
  @io = ::UNIXSocket.new(@path).tap do |socket|
    socket.sync = sync unless sync.nil?
  end
end