Runtime-sink-flush
Flush a RuntimeSink and return how much work was advanced. This is the direct runtime control API behind configured logger flush behavior.
Interface
pub fn RuntimeSink::flush(self : RuntimeSink) -> Int {input
self : RuntimeSink- Runtime sink whose pending file or queue work should be flushed.
output
Int- Count of advanced operations as reported by the concrete runtime sink variant.
Explanation
Detailed rules explaining key parameters and behaviors
- Plain console-style runtime sinks return
0because they do not keep explicit buffered flush state here. - Plain file runtime sinks call
FileSink::flush()and convert the boolean result into1or0. - Queue-wrapped runtime sinks forward to the wrapped queue sink's
flush()behavior. - This method is the direct sink-level API used by
ConfiguredLogger::flush(...).
How to Use
Here are some specific examples provided.
When Need Direct Runtime Flush Control
When code is working with a RuntimeSink value directly instead of going through ConfiguredLogger:
let flushed = sink.flush()In this example, the runtime sink reports how much flush work was advanced.
When Need Queue Or File Progress Visibility
When support code should observe whether a direct flush request did useful work:
if sink.flush() > 0 {
()
}In this example, the return value reflects whether queue draining or file flushing advanced any work.
Error Case
e.g.:
If the runtime sink shape has no flushable state, the method may simply return
0.If callers need bounded queue progress,
drain(...)is the better API.
Notes
Use this helper when direct runtime sink flushing matters.
ConfiguredLogger::flush(...)is the higher-level wrapper for config-built loggers.