Class: LogStashLogger::Device::Unix

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

Instance Attribute Summary

Attributes inherited from Connectable

#buffer_logger

Attributes inherited from Base

#error_logger, #io, #sync

Instance Method Summary collapse

Methods inherited from Connectable

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

Methods included from Buffer

#buffer_flush, #buffer_full?, #buffer_initialize, #buffer_receive, #reset_buffer

Methods inherited from Base

#close, #close!, #flush, #to_io, #unrecoverable_error?, #write, #write_batch, #write_one

Constructor Details

#initialize(opts = {}) ⇒ 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