Files
BitLogger/docs/api/configured-logger-close.md
T
2026-06-13 23:58:00 +08:00

2.1 KiB

name, group, category, update-time, description, key-word
name group category update-time description key-word
configured-logger-close api runtime 20260613 Close the configured runtime logger sink and return whether the wrapped RuntimeSink reported a successful close action.
logger
runtime
lifecycle
public

Configured-logger-close

Close the sink behind a ConfiguredLogger. This helper is the configured logger wrapper over RuntimeSink::close(...) for config-driven runtime teardown.

Interface

pub fn ConfiguredLogger::close(self : ConfiguredLogger) -> Bool {}

input

  • self : ConfiguredLogger - Config-driven runtime logger whose sink should be closed.

output

  • Bool - Whether the wrapped RuntimeSink::close(...) call reported a successful close action.

Explanation

Detailed rules explaining key parameters and behaviors

  • This helper delegates directly to self.sink.close().
  • Plain file sinks forward to FileSink::close() through RuntimeSink.
  • Queue-backed file sinks close the wrapped file sink instead of only the queue wrapper.
  • Console-style sinks and queue-wrapped console-style sinks return true as a no-op success because they do not expose a meaningful close step here.

How to Use

Here are some specific examples provided.

When Need Config-driven Runtime Teardown

When a config-built logger should release its sink resources:

ignore(logger.close())

In this example, sink teardown happens through the configured logger facade.

When Need To Observe Close Outcome

When application code wants a success flag from runtime close behavior:

let closed = logger.close()

In this example, callers can branch on the reported close result.

Error Case

e.g.:

  • If the configured runtime sink shape has no real close action, the helper may still return true as a no-op success.

  • If callers need a file-specific close path with queue flush nuances, file_close() may be the better API.

Notes

  1. This is the generic configured runtime close helper.

  2. Prefer file-specific helpers when the configured sink shape is known to be file-backed.