Class: LogStashLogger::Device::Socket

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

Direct Known Subclasses

TCP, UDP

Constant Summary collapse

DEFAULT_HOST =
'0.0.0.0'

Instance Attribute Summary collapse

Attributes inherited from Base

#error_logger, #io, #sync

Instance Method Summary collapse

Methods inherited from Connectable

#close, #connect, #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, #write, #write_batch, #write_one

Constructor Details

#initialize(opts) ⇒ Socket

Returns a new instance of Socket.



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

def initialize(opts)
  super
  @port = opts[:port] || fail(ArgumentError, "Port is required")
  @host = opts[:host] || DEFAULT_HOST
end

Instance Attribute Details

#hostObject (readonly)

Returns the value of attribute host.



8
9
10
# File 'lib/logstash-logger/device/socket.rb', line 8

def host
  @host
end

#portObject (readonly)

Returns the value of attribute port.



8
9
10
# File 'lib/logstash-logger/device/socket.rb', line 8

def port
  @port
end

Instance Method Details

#unrecoverable_error?(e) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/logstash-logger/device/socket.rb', line 16

def unrecoverable_error?(e)
  e.is_a?(Errno::EMSGSIZE) || super
end