mirror of
https://github.com/Nanaloveyuki/BitLogger.git
synced 2026-05-30 15:42:25 +00:00
37 lines
794 B
MoonBit
37 lines
794 B
MoonBit
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")
|
|
}
|