mirror of
https://github.com/Nanaloveyuki/BitLogger.git
synced 2026-05-30 23:52:27 +00:00
✨ Add file sink state snapshots
This commit is contained in:
@@ -405,6 +405,24 @@ pub fn RuntimeSink::file_rotation_failures(self : RuntimeSink) -> Int {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn RuntimeSink::file_state(self : RuntimeSink) -> FileSinkState {
|
||||
match self {
|
||||
File(sink) => sink.state()
|
||||
QueuedFile(sink) => sink.sink.state()
|
||||
_ => {
|
||||
path: "",
|
||||
available: false,
|
||||
append: false,
|
||||
auto_flush: false,
|
||||
rotation: None,
|
||||
open_failures: 0,
|
||||
write_failures: 0,
|
||||
flush_failures: 0,
|
||||
rotation_failures: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub type ConfiguredLogger = Logger[RuntimeSink]
|
||||
|
||||
pub fn ConfiguredLogger::flush(self : ConfiguredLogger) -> Int {
|
||||
@@ -510,6 +528,10 @@ pub fn ConfiguredLogger::file_rotation_failures(self : ConfiguredLogger) -> Int
|
||||
self.sink.file_rotation_failures()
|
||||
}
|
||||
|
||||
pub fn ConfiguredLogger::file_state(self : ConfiguredLogger) -> FileSinkState {
|
||||
self.sink.file_state()
|
||||
}
|
||||
|
||||
fn expect_object(
|
||||
value : @json_parser.JsonValue,
|
||||
context : String,
|
||||
|
||||
Reference in New Issue
Block a user