mirror of
https://github.com/Nanaloveyuki/BitLogger.git
synced 2026-05-30 15:42:25 +00:00
✨ Add native async logger adapter package
This commit is contained in:
@@ -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")
|
||||
}
|
||||
Reference in New Issue
Block a user