Files
BitLogger/docs/api/configured-logger-file-flush-failures.md
T
2026-05-12 14:59:59 +08:00

1.9 KiB

name, group, category, update-time, description, key-word
name group category update-time description key-word
configured-logger-file-flush-failures api runtime 20260512 Read the number of flush failures recorded by the configured runtime file sink.
logger
runtime
file
public

Configured-logger-file-flush-failures

Read the number of flush failures recorded by a ConfiguredLogger file sink. This helper is useful for diagnosing durability-path problems on file-backed loggers.

Interface

pub fn ConfiguredLogger::file_flush_failures(self : ConfiguredLogger) -> Int {}

input

  • self : ConfiguredLogger - Config-driven runtime logger whose flush-failure counter should be inspected.

output

  • Int - Number of recorded flush failures.

Explanation

Detailed rules explaining key parameters and behaviors

  • File-backed sinks report their recorded flush-failure count.
  • Queued file sinks forward the metric from the wrapped file sink.
  • Non-file sinks return 0.
  • The counter is cumulative until reset.

How to Use

Here are some specific examples provided.

When Need Durability-path Diagnostics

When support output should show flush-path instability:

let count = logger.file_flush_failures()

In this example, the configured logger exposes whether flush attempts have been failing.

When Inspect Effects Of Auto-flush Policy

When runtime durability tuning should be inspected operationally:

ignore(logger.file_flush_failures())

In this example, callers can correlate flush failures with runtime file policy choices.

Error Case

e.g.:

  • If the configured sink is not file-backed, the method returns 0.

  • If callers need current policy and counters together, file_state() is the better API.

Notes

  1. Use this helper when flush-path reliability matters.

  2. Pair it with file_auto_flush() and file_flush() when diagnosing durability behavior.