Class: LogStashLogger::Device::Connectable

Inherits:
Base
  • Object
show all
Defined in:
lib/logstash-logger/device/connectable.rb

Direct Known Subclasses

Kafka, Redis, Socket, Unix

Instance Attribute Summary

Attributes inherited from Base

#io, #sync

Instance Method Summary collapse

Methods inherited from Base

#close, #initialize

Constructor Details

This class inherits a constructor from LogStashLogger::Device::Base

Instance Method Details

#connected?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/logstash-logger/device/connectable.rb', line 23

def connected?
  !!@io
end

#flushObject



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

def flush
  return unless connected?
  with_connection do
    super
  end
end

#to_ioObject



17
18
19
20
21
# File 'lib/logstash-logger/device/connectable.rb', line 17

def to_io
  with_connection do
    @io
  end
end

#write(message) ⇒ Object



4
5
6
7
8
# File 'lib/logstash-logger/device/connectable.rb', line 4

def write(message)
  with_connection do
    super
  end
end