🔊 Update 1.0.0

This commit is contained in:
Nanaloveyuki
2026-06-27 10:45:36 +08:00
parent 7557e37cc8
commit c8023b0ded
55 changed files with 5734 additions and 2360 deletions
+29 -14
View File
@@ -1,8 +1,10 @@
///|
pub struct FileRotation {
max_bytes : Int
max_backups : Int
}
///|
pub struct FileSinkState {
path : String
available : Bool
@@ -15,30 +17,33 @@ pub struct FileSinkState {
rotation_failures : Int
}
///|
pub struct FileSinkPolicy {
append : Bool
auto_flush : Bool
rotation : FileRotation?
}
///|
pub fn FileSinkPolicy::new(
append~ : Bool = true,
auto_flush~ : Bool = true,
rotation~ : FileRotation? = None,
append? : Bool = true,
auto_flush? : Bool = true,
rotation? : FileRotation? = None,
) -> FileSinkPolicy {
{ append, auto_flush, rotation }
}
///|
pub fn FileSinkState::new(
path : String,
available~ : Bool = false,
append~ : Bool = true,
auto_flush~ : Bool = true,
rotation~ : FileRotation? = None,
open_failures~ : Int = 0,
write_failures~ : Int = 0,
flush_failures~ : Int = 0,
rotation_failures~ : Int = 0,
available? : Bool = false,
append? : Bool = true,
auto_flush? : Bool = true,
rotation? : FileRotation? = None,
open_failures? : Int = 0,
write_failures? : Int = 0,
flush_failures? : Int = 0,
rotation_failures? : Int = 0,
) -> FileSinkState {
{
path,
@@ -53,13 +58,23 @@ pub fn FileSinkState::new(
}
}
pub fn file_rotation(max_bytes : Int, max_backups~ : Int = 1) -> FileRotation {
///|
pub fn file_rotation(max_bytes : Int, max_backups? : Int = 1) -> FileRotation {
{
max_bytes: if max_bytes <= 0 { 1 } else { max_bytes },
max_backups: if max_backups <= 0 { 1 } else { max_backups },
max_bytes: if max_bytes <= 0 {
1
} else {
max_bytes
},
max_backups: if max_backups <= 0 {
1
} else {
max_backups
},
}
}
///|
pub(all) enum QueueOverflowPolicy {
DropNewest
DropOldest