Add native async logger adapter package

This commit is contained in:
Nanaloveyuki
2026-05-08 17:28:37 +08:00
parent 9a0d7abd8e
commit a99d2658f4
8 changed files with 371 additions and 10 deletions
+36
View File
@@ -0,0 +1,36 @@
pub(all) suberror AsyncLoggerClosed {
AsyncLoggerClosed
}
pub(all) enum AsyncOverflowPolicy {
Blocking
DropOldest
DropNewest
}
pub struct AsyncLoggerConfig {
max_pending : Int
overflow : AsyncOverflowPolicy
}
pub fn AsyncLoggerConfig::new(
max_pending~ : Int = 0,
overflow~ : AsyncOverflowPolicy = AsyncOverflowPolicy::Blocking,
) -> AsyncLoggerConfig {
{ max_pending, overflow }
}
pub struct AsyncLogger[S] {}
pub fn async_logger[S : @bitlogger.Sink](
sink : S,
config~ : AsyncLoggerConfig = AsyncLoggerConfig::new(),
min_level~ : @bitlogger.Level = @bitlogger.Level::Info,
target~ : String = "",
) -> AsyncLogger[S] {
ignore(sink)
ignore(config)
ignore(min_level)
ignore(target)
abort("bitlogger_async currently only supports native/llvm backends")
}