Class: Onlylogs::HttpLogger

Inherits:
Logger
  • Object
show all
Defined in:
lib/onlylogs/http_logger.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(local_fallback: $stdout, **device_options) ⇒ HttpLogger

Returns a new instance of HttpLogger.



18
19
20
21
# File 'lib/onlylogs/http_logger.rb', line 18

def initialize(local_fallback: $stdout, **device_options)
  @device = HttpDevice.new(**device_options)
  super(MultiDevice.new(local_fallback, @device))
end

Instance Attribute Details

#deviceObject (readonly)

Returns the value of attribute device.



16
17
18
# File 'lib/onlylogs/http_logger.rb', line 16

def device
  @device
end

Instance Method Details

#closeObject

Only the remote device 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).



30
31
32
# File 'lib/onlylogs/http_logger.rb', line 30

def close
  @device.close
end

#flushObject

Drain the device's in-memory queue to the drain now (tests and graceful shutdown rely on it).



24
25
26
# File 'lib/onlylogs/http_logger.rb', line 24

def flush
  @device.flush
end