File-sink-set-rotation
Update the rotation configuration used by a FileSink. This helper changes direct runtime file rotation behavior without rebuilding or reopening the sink.
Interface
pub fn FileSink::set_rotation(self : FileSink, rotation : FileRotation?) -> Unit {input
self : FileSink- File sink whose rotation policy should change.rotation : FileRotation?- New rotation config, orNoneto disable rotation.
Explanation
Detailed rules explaining key parameters and behaviors
- This method updates runtime rotation policy only.
- Passing
Nonedisables rotation. - It does not reopen the sink or rotate immediately by itself.
- Append and auto-flush settings are left unchanged.
How to Use
Here are some specific examples provided.
When Need Runtime Rotation Tuning
When a concrete file sink should enable or change rotation dynamically:
sink.set_rotation(Some(file_rotation(1024, max_backups=3)))In this example, direct runtime rotation behavior is updated without rebuilding the sink.
When Need To Disable Rotation
When the file sink should stop rotating:
sink.set_rotation(None)In this example, the sink has its rotation policy cleared explicitly.
Error Case
e.g.:
If callers only want to remove rotation,
clear_rotation()is the more direct API.This helper does not report past rotation failures; use
rotation_failures()orstate()for diagnostics.
Notes
Use this helper when setting a full runtime rotation config.
It is useful for operational tuning on a concrete file sink without rebuilding it.