mirror of
https://github.com/Nanaloveyuki/BitLogger.git
synced 2026-07-31 15:34:58 +00:00
✅ cover lib async clear shutdown
This commit is contained in:
@@ -1172,6 +1172,32 @@ async test "library async builder unwrap matches direct async builder behavior"
|
|||||||
inspect(full.last_error() == direct.last_error(), content="true")
|
inspect(full.last_error() == direct.last_error(), content="true")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async test "library async builder shutdown clear abandons pending records through facade" {
|
||||||
|
let logger = build_library_async_logger(
|
||||||
|
AsyncLoggerBuildConfig::new(
|
||||||
|
logger=@bitlogger.LoggerConfig::new(
|
||||||
|
min_level=@bitlogger.Level::Info,
|
||||||
|
target="async.lib.builder.clear",
|
||||||
|
sink=@bitlogger.SinkConfig::new(kind=@bitlogger.SinkKind::Console),
|
||||||
|
),
|
||||||
|
async_config=AsyncLoggerConfig::new(
|
||||||
|
max_pending=2,
|
||||||
|
overflow=AsyncOverflowPolicy::Blocking,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
let full = logger.to_async_logger()
|
||||||
|
|
||||||
|
logger.info("one")
|
||||||
|
inspect(full.pending_count(), content="1")
|
||||||
|
inspect(full.dropped_count(), content="0")
|
||||||
|
logger.shutdown(clear=true)
|
||||||
|
inspect(full.is_closed(), content="true")
|
||||||
|
inspect(full.is_running(), content="false")
|
||||||
|
inspect(full.pending_count(), content="0")
|
||||||
|
inspect(full.dropped_count(), content="1")
|
||||||
|
}
|
||||||
|
|
||||||
async test "parsed library async logger unwrap keeps async helper surface" {
|
async test "parsed library async logger unwrap keeps async helper surface" {
|
||||||
let logger = parse_and_build_library_async_logger(
|
let logger = parse_and_build_library_async_logger(
|
||||||
"{\"logger\":{\"min_level\":\"warn\",\"target\":\"async.lib.config.helpers\",\"sink\":{\"kind\":\"console\"}},\"async_config\":{\"max_pending\":2,\"overflow\":\"DropOldest\",\"max_batch\":1,\"linger_ms\":0,\"flush\":\"Shutdown\"}}",
|
"{\"logger\":{\"min_level\":\"warn\",\"target\":\"async.lib.config.helpers\",\"sink\":{\"kind\":\"console\"}},\"async_config\":{\"max_pending\":2,\"overflow\":\"DropOldest\",\"max_batch\":1,\"linger_ms\":0,\"flush\":\"Shutdown\"}}",
|
||||||
|
|||||||
Reference in New Issue
Block a user