Class: Onlylogs::SocketLogger
- Inherits:
-
Logger
- Object
- Logger
- Onlylogs::SocketLogger
- Defined in:
- lib/onlylogs/socket_logger.rb
Instance Attribute Summary collapse
-
#device ⇒ Object
readonly
Returns the value of attribute device.
Instance Method Summary collapse
-
#close ⇒ Object
Only the remote socket is ours to close; the local fallback ($stdout) belongs to the app, so we deliberately do not call super (which would close the whole log device, fallback included).
-
#initialize(local_fallback: $stdout, socket_path: ENV.fetch("ONLYLOGS_SIDECAR_SOCKET", SocketDevice::DEFAULT_SOCKET)) ⇒ SocketLogger
constructor
A new instance of SocketLogger.
Constructor Details
#initialize(local_fallback: $stdout, socket_path: ENV.fetch("ONLYLOGS_SIDECAR_SOCKET", SocketDevice::DEFAULT_SOCKET)) ⇒ SocketLogger
Returns a new instance of SocketLogger.
16 17 18 19 |
# File 'lib/onlylogs/socket_logger.rb', line 16 def initialize(local_fallback: $stdout, socket_path: ENV.fetch("ONLYLOGS_SIDECAR_SOCKET", SocketDevice::DEFAULT_SOCKET)) @device = SocketDevice.new(socket_path: socket_path) super(MultiDevice.new(local_fallback, @device)) end |
Instance Attribute Details
#device ⇒ Object (readonly)
Returns the value of attribute device.
14 15 16 |
# File 'lib/onlylogs/socket_logger.rb', line 14 def device @device end |
Instance Method Details
#close ⇒ Object
Only the remote socket is ours to close; the local fallback ($stdout) belongs to the app, so we deliberately do not call super (which would close the whole log device, fallback included).
23 24 25 |
# File 'lib/onlylogs/socket_logger.rb', line 23 def close @device.close end |