Add explicit append and truncate reopen helpers

This commit is contained in:
Nanaloveyuki
2026-05-10 12:55:02 +08:00
parent c779befc23
commit 1a9dfe2397
8 changed files with 62 additions and 19 deletions
+24
View File
@@ -239,6 +239,22 @@ pub fn RuntimeSink::file_reopen_with_current_policy(self : RuntimeSink) -> Bool
}
}
pub fn RuntimeSink::file_reopen_append(self : RuntimeSink) -> Bool {
match self {
File(sink) => sink.reopen_append()
QueuedFile(sink) => sink.sink.reopen_append()
_ => false
}
}
pub fn RuntimeSink::file_reopen_truncate(self : RuntimeSink) -> Bool {
match self {
File(sink) => sink.reopen_truncate()
QueuedFile(sink) => sink.sink.reopen_truncate()
_ => false
}
}
pub fn RuntimeSink::file_append_mode(self : RuntimeSink) -> Bool {
match self {
File(sink) => sink.append_mode()
@@ -423,6 +439,14 @@ pub fn ConfiguredLogger::file_reopen_with_current_policy(self : ConfiguredLogger
self.sink.file_reopen_with_current_policy()
}
pub fn ConfiguredLogger::file_reopen_append(self : ConfiguredLogger) -> Bool {
self.sink.file_reopen_append()
}
pub fn ConfiguredLogger::file_reopen_truncate(self : ConfiguredLogger) -> Bool {
self.sink.file_reopen_truncate()
}
pub fn ConfiguredLogger::file_append_mode(self : ConfiguredLogger) -> Bool {
self.sink.file_append_mode()
}