Files
BitLogger/docs/api/configured-logger-file-rotation-config.md
2026-05-12 14:52:23 +08:00

2.1 KiB

name, group, category, update-time, description, key-word
name group category update-time description key-word
configured-logger-file-rotation-config api runtime 20260512 Read the current rotation configuration used by the configured runtime file sink.
logger
runtime
file
public

Configured-logger-file-rotation-config

Read the current rotation configuration used by a ConfiguredLogger file sink. This helper exposes the active runtime rotation parameters when rotation is enabled.

Interface

pub fn ConfiguredLogger::file_rotation_config(self : ConfiguredLogger) -> FileRotation? {}

input

  • self : ConfiguredLogger - Config-driven runtime logger whose rotation config should be inspected.

output

  • FileRotation? - Current rotation config, or None if rotation is disabled or the sink is not file-backed.

Explanation

Detailed rules explaining key parameters and behaviors

  • File-backed sinks return their current rotation configuration when enabled.
  • Queued file sinks forward the config from the wrapped file sink.
  • Non-file sinks return None.
  • This helper is useful when callers need active runtime rotation parameters rather than only a boolean flag.

How to Use

Here are some specific examples provided.

When Need Runtime Rotation Parameters

When support output should include the active rotation policy:

let rotation = logger.file_rotation_config()

In this example, the configured logger exposes live runtime rotation parameters directly.

When Branch On Optional Rotation Presence

When code should react differently for rotating file sinks:

match logger.file_rotation_config() {
  Some(cfg) => ignore(cfg)
  None => ()
}

In this example, optional return shape reflects whether rotation is active.

Error Case

e.g.:

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

  • If callers only need to know whether rotation is enabled, file_rotation_enabled() is the simpler API.

Notes

  1. Use this helper when current runtime rotation parameters matter.

  2. It is useful after policy updates or recovery flows.