Add explicit reopen-with-policy helper

This commit is contained in:
Nanaloveyuki
2026-05-10 12:52:01 +08:00
parent 0a7af44f06
commit c779befc23
8 changed files with 36 additions and 11 deletions
+12
View File
@@ -231,6 +231,14 @@ pub fn RuntimeSink::file_reopen(self : RuntimeSink, append~ : Bool? = None) -> B
}
}
pub fn RuntimeSink::file_reopen_with_current_policy(self : RuntimeSink) -> Bool {
match self {
File(sink) => sink.reopen_with_current_policy()
QueuedFile(sink) => sink.sink.reopen_with_current_policy()
_ => false
}
}
pub fn RuntimeSink::file_append_mode(self : RuntimeSink) -> Bool {
match self {
File(sink) => sink.append_mode()
@@ -411,6 +419,10 @@ pub fn ConfiguredLogger::file_reopen(self : ConfiguredLogger, append~ : Bool? =
self.sink.file_reopen(append=append)
}
pub fn ConfiguredLogger::file_reopen_with_current_policy(self : ConfiguredLogger) -> Bool {
self.sink.file_reopen_with_current_policy()
}
pub fn ConfiguredLogger::file_append_mode(self : ConfiguredLogger) -> Bool {
self.sink.file_append_mode()
}