Configured-logger-file-write-failures
Read the number of write failures recorded by a ConfiguredLogger file sink. This helper is useful for diagnosing runtime write-path problems.
Interface
pub fn ConfiguredLogger::file_write_failures(self : ConfiguredLogger) -> Int {}input
self : ConfiguredLogger- Config-driven runtime logger whose write-failure counter should be inspected.
output
Int- Number of recorded write failures.
Explanation
Detailed rules explaining key parameters and behaviors
- File-backed sinks report their recorded write-failure count through the wrapped
RuntimeSink. - Queued file sinks forward the metric from the wrapped inner file sink.
- For queued file sinks, enqueueing a record does not increment this counter by itself. The counter changes only when queued records are drained into the inner file sink, such as through
file_flush(). - Non-file sinks return
0. - The counter is cumulative until reset.
How to Use
Here are some specific examples provided.
When Need Runtime Write-path Diagnostics
When support output should show whether writes have been failing:
let count = logger.file_write_failures()In this example, callers get a focused signal for file write-path health.
When Compare Sink Health After Recovery
When recovery logic should verify whether new failures still occur:
ignore(logger.file_write_failures())In this example, the metric helps measure whether runtime writes improved after intervention.
Error Case
e.g.:
If the configured sink is not file-backed, the method returns
0.If callers need a fuller view of file health,
file_state()orfile_runtime_state()may be better APIs.
Notes
Use this helper for focused write-failure visibility.
Pair it with
file_flush()andfile_flush_failures()when diagnosing queued output-path instability.