cover app text async composition

This commit is contained in:
Nanaloveyuki
2026-06-14 06:24:17 +08:00
parent 057eb7c1fc
commit fd9127c524
+41
View File
@@ -2214,6 +2214,47 @@ async test "application text async logger keeps async helper surface" {
inspect(logger.last_error(), content="")
}
async test "application text async logger keeps broader async composition surface" {
let logger : ApplicationTextAsyncLogger = build_application_text_async_logger(
AsyncLoggerBuildConfig::new(
logger=@bitlogger.text_console(
min_level=@bitlogger.Level::Warn,
target="async.app.text.compose",
text_formatter=@bitlogger.TextFormatterConfig::new(show_timestamp=false, separator=" | "),
),
async_config=AsyncLoggerConfig::new(
max_pending=2,
overflow=AsyncOverflowPolicy::DropNewest,
flush=AsyncFlushPolicy::Shutdown,
),
),
)
.with_timestamp()
.with_context_fields([@bitlogger.field("service", "bitlogger")])
.child("worker")
inspect(logger.target, content="async.app.text.compose.worker")
inspect(logger.timestamp, content="true")
inspect(logger.is_enabled(@bitlogger.Level::Error), content="true")
inspect(logger.is_enabled(@bitlogger.Level::Info), content="false")
logger.error("one")
logger.error("two")
inspect(logger.pending_count(), content="2")
inspect(logger.dropped_count(), content="0")
@async.with_task_group(group => {
group.spawn_bg(() => logger.run())
logger.shutdown()
})
inspect(logger.is_closed(), content="true")
inspect(logger.pending_count(), content="0")
inspect(logger.dropped_count(), content="0")
inspect(logger.has_failed(), content="false")
inspect(logger.last_error(), content="")
}
test "application text async logger builder ignores sync queue layer" {
let logger = build_application_text_async_logger(
AsyncLoggerBuildConfig::new(