Class: Zizq::Configuration::FlushingIO

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/zizq/configuration.rb

Overview

IO delegator that flushes the underlying IO after every write. We wrap ‘$stdout` in this for the default logger so log lines appear immediately when stdout is connected to a pipe (foreman, systemd, k8s). Without it, the C-stdio default switches from line-buffered to fully-buffered for pipes and log output piles up in a 4–8KB buffer until the process exits.

The wrapper is local to the default logger — apps supplying their own ‘c.logger = …` retain full control over flushing.

Instance Method Summary collapse

Instance Method Details

#closeObject

Declared explicitly so the type checker sees us satisfying ‘Logger::_WriteCloser`; SimpleDelegator forwards `close` via `method_missing`, but Steep doesn’t follow that.



238
239
240
# File 'lib/zizq/configuration.rb', line 238

def close #: () -> void
  __getobj__.close
end

#write(*args) ⇒ Object

: (*untyped) -> Integer



229
230
231
232
233
# File 'lib/zizq/configuration.rb', line 229

def write(*args) #: (*untyped) -> Integer
  result = super
  __getobj__.flush
  result
end