Runtime-sink-file-set-rotation
Update the rotation configuration used by a file-backed RuntimeSink. This helper changes direct runtime file rotation behavior without rebuilding or rewrapping the sink.
Interface
pub fn RuntimeSink::file_set_rotation(self : RuntimeSink, rotation : FileRotation?) -> Bool {input
self : RuntimeSink- Runtime sink whose rotation policy should change.rotation : FileRotation?- New rotation config, orNoneto disable rotation.
output
Bool- Whether the policy update was applied.
Explanation
Detailed rules explaining key parameters and behaviors
- Plain
Fileruntime variants update the wrappedFileSinkrotation policy and returntrue. QueuedFileruntime variants forward the update to the wrapped innerFileSinkand returntrue.- Passing
Nonedisables rotation. - Non-file runtime variants return
false.
How to Use
Here are some specific examples provided.
When Need Direct Runtime Rotation Tuning
When a file-backed runtime sink should enable or change rotation dynamically:
ignore(sink.file_set_rotation(Some(file_rotation(1024, max_backups=3))))In this example, runtime rotation behavior is updated without rebuilding the sink.
When Need To Disable Rotation Through The Setter
When the file sink should stop rotating through one general update path:
let ok = sink.file_set_rotation(None)In this example, the direct runtime file sink has its rotation policy cleared explicitly.
Error Case
e.g.:
If the runtime sink is not file-backed, the method returns
false.If callers only want to remove rotation,
file_clear_rotation()is the more direct API.
Notes
Use this helper when setting a full direct runtime rotation config.
It is useful for operational tuning without rebuilding the sink.