2.2 KiB
name, group, category, update-time, description, key-word
| name | group | category | update-time | description | key-word | ||||
|---|---|---|---|---|---|---|---|---|---|
| configured-logger-flush | api | runtime | 20260613 | Flush a configured runtime logger and return how many queued or file-backed operations were advanced through RuntimeSink. |
|
Configured-logger-flush
Flush a ConfiguredLogger and return how much work was advanced. This is the configured logger wrapper over RuntimeSink::flush(...) for forcing queued or file-backed output to move forward after config-driven construction.
Interface
pub fn ConfiguredLogger::flush(self : ConfiguredLogger) -> Int {}
input
self : ConfiguredLogger- Config-driven runtime logger whose sink should be flushed.
output
Int- Count returned by the wrappedRuntimeSink::flush(...)call.
Explanation
Detailed rules explaining key parameters and behaviors
- This helper delegates directly to
self.sink.flush(). - Queue-wrapped sinks forward to the concrete queue sink's
flush()behavior. - Plain file sinks call
FileSink::flush()throughRuntimeSinkand convert the boolean result into1or0. - Plain console-style sinks return
0because they do not expose a meaningful buffered flush step here.
How to Use
Here are some specific examples provided.
When Need Explicit Queue Progress
When config-built queue output should be advanced manually:
ignore(logger.flush())
In this example, the configured runtime logger is flushed without reaching into the sink directly.
When Need A Post-write Flush Barrier
When a service wants stronger delivery behavior after a burst of writes:
let flushed = logger.flush()
In this example, callers can observe how much work was advanced by the flush request.
Error Case
e.g.:
-
If the configured runtime sink shape has no flushable state, the method may simply return
0. -
If callers need bounded manual draining rather than generic flush behavior,
drain(...)is the better API.
Notes
-
Use this helper after config-driven logger construction when explicit runtime flushing matters.
-
The exact return value depends on which
RuntimeSinkvariant the configured logger owns.