mirror of
https://github.com/Nanaloveyuki/BitLogger.git
synced 2026-07-23 16:32:19 +00:00
🧪 relocate test logs
This commit is contained in:
@@ -0,0 +1 @@
|
||||
|
||||
@@ -2404,7 +2404,7 @@ async test "library async parse-build unwrap matches parsed direct async builder
|
||||
|
||||
///|
|
||||
async test "library async parse-build unwrap preserves file-backed runtime helpers" {
|
||||
let raw = "{\"logger\":{\"min_level\":\"warn\",\"target\":\"async.lib.json.file.same-build\",\"queue\":{\"max_pending\":3,\"overflow\":\"DropOldest\"},\"sink\":{\"kind\":\"file\",\"path\":\"async-lib-json-file-same-build.log\"}},\"async_config\":{\"max_pending\":2,\"overflow\":\"DropOldest\",\"max_batch\":1,\"linger_ms\":0,\"flush\":\"Shutdown\"}}"
|
||||
let raw = "{\"logger\":{\"min_level\":\"warn\",\"target\":\"async.lib.json.file.same-build\",\"queue\":{\"max_pending\":3,\"overflow\":\"DropOldest\"},\"sink\":{\"kind\":\"file\",\"path\":\"logs/async-lib-json-file-same-build.log\"}},\"async_config\":{\"max_pending\":2,\"overflow\":\"DropOldest\",\"max_batch\":1,\"linger_ms\":0,\"flush\":\"Shutdown\"}}"
|
||||
let logger = parse_and_build_library_async_logger(raw)
|
||||
let full = logger.to_async_logger()
|
||||
let direct = build_async_logger(parse_async_logger_build_config_text(raw))
|
||||
@@ -2920,7 +2920,7 @@ test "library async text logger ignores sink kind and still uses text formatter"
|
||||
target="async.lib.text.kind",
|
||||
sink=@bitlogger.SinkConfig::new(
|
||||
kind=@bitlogger.SinkKind::File,
|
||||
path="ignored.log",
|
||||
path="logs/ignored.log",
|
||||
text_formatter=@bitlogger.TextFormatterConfig::new(
|
||||
show_timestamp=false,
|
||||
separator=" | ",
|
||||
@@ -3233,7 +3233,7 @@ async test "async logger projection preserves file-backed runtime helpers throug
|
||||
target="async.projected.file",
|
||||
sink=@bitlogger.SinkConfig::new(
|
||||
kind=@bitlogger.SinkKind::File,
|
||||
path="async-projected-file.log",
|
||||
path="logs/async-projected-file.log",
|
||||
),
|
||||
queue=Some(
|
||||
@bitlogger.QueueConfig::new(
|
||||
@@ -3530,7 +3530,7 @@ async test "application async builder preserves file-backed runtime helpers" {
|
||||
target="async.app.file.same-build",
|
||||
sink=@bitlogger.SinkConfig::new(
|
||||
kind=@bitlogger.SinkKind::File,
|
||||
path="async-app-file-same-build.log",
|
||||
path="logs/async-app-file-same-build.log",
|
||||
),
|
||||
queue=Some(
|
||||
@bitlogger.QueueConfig::new(
|
||||
@@ -4384,7 +4384,7 @@ test "application text async logger ignores sink kind and still uses text format
|
||||
target="async.app.text.kind.alias",
|
||||
sink=@bitlogger.SinkConfig::new(
|
||||
kind=@bitlogger.SinkKind::File,
|
||||
path="ignored.log",
|
||||
path="logs/ignored.log",
|
||||
text_formatter=@bitlogger.TextFormatterConfig::new(
|
||||
show_timestamp=false,
|
||||
separator=" | ",
|
||||
@@ -4462,7 +4462,7 @@ test "build async text logger ignores sink kind and still uses text formatter" {
|
||||
target="async.text.kind",
|
||||
sink=@bitlogger.SinkConfig::new(
|
||||
kind=@bitlogger.SinkKind::File,
|
||||
path="ignored.log",
|
||||
path="logs/ignored.log",
|
||||
text_formatter=@bitlogger.TextFormatterConfig::new(
|
||||
show_timestamp=false,
|
||||
separator=" | ",
|
||||
@@ -4959,7 +4959,7 @@ async test "application async parse-build matches parsed direct async builder be
|
||||
|
||||
///|
|
||||
async test "application async parse-build preserves file-backed runtime helpers" {
|
||||
let raw = "{\"logger\":{\"min_level\":\"warn\",\"target\":\"async.app.json.file.same-build\",\"queue\":{\"max_pending\":3,\"overflow\":\"DropOldest\"},\"sink\":{\"kind\":\"file\",\"path\":\"async-app-json-file-same-build.log\"}},\"async_config\":{\"max_pending\":2,\"overflow\":\"DropOldest\",\"max_batch\":1,\"linger_ms\":0,\"flush\":\"Shutdown\"}}"
|
||||
let raw = "{\"logger\":{\"min_level\":\"warn\",\"target\":\"async.app.json.file.same-build\",\"queue\":{\"max_pending\":3,\"overflow\":\"DropOldest\"},\"sink\":{\"kind\":\"file\",\"path\":\"logs/async-app-json-file-same-build.log\"}},\"async_config\":{\"max_pending\":2,\"overflow\":\"DropOldest\",\"max_batch\":1,\"linger_ms\":0,\"flush\":\"Shutdown\"}}"
|
||||
let application = parse_and_build_application_async_logger(raw)
|
||||
let direct = build_async_logger(parse_async_logger_build_config_text(raw))
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
///|
|
||||
test "file sink tracks rotation failures on unavailable backend" {
|
||||
let path = "bitlogger-rotate.log"
|
||||
let path = "logs/bitlogger-rotate.log"
|
||||
ignore(@utils.remove_file_internal(path))
|
||||
ignore(@utils.remove_file_internal(path + ".1"))
|
||||
let sink = file_sink(path, rotation=Some(file_rotation(1, max_backups=1)))
|
||||
@@ -19,7 +19,7 @@ test "file sink tracks rotation failures on unavailable backend" {
|
||||
|
||||
///|
|
||||
test "file sink reopen and failure counters reflect backend state" {
|
||||
let sink = file_sink("bitlogger-reopen.log")
|
||||
let sink = file_sink("logs/bitlogger-reopen.log")
|
||||
if sink.is_available() {
|
||||
inspect(sink.append_mode(), content="true")
|
||||
inspect(sink.open_failures(), content="0")
|
||||
@@ -45,7 +45,7 @@ test "file sink reopen and failure counters reflect backend state" {
|
||||
inspect(sink.flush_failures(), content="0")
|
||||
inspect(sink.rotation_failures(), content="0")
|
||||
inspect(sink.close(), content="true")
|
||||
ignore(@utils.remove_file_internal("bitlogger-reopen.log"))
|
||||
ignore(@utils.remove_file_internal("logs/bitlogger-reopen.log"))
|
||||
} else {
|
||||
inspect(sink.append_mode(), content="true")
|
||||
inspect(sink.open_failures(), content="1")
|
||||
@@ -71,7 +71,7 @@ test "file sink reopen and failure counters reflect backend state" {
|
||||
|
||||
///|
|
||||
test "file sink can rotate on native backend" {
|
||||
let path = "bitlogger-rotate-native.log"
|
||||
let path = "logs/bitlogger-rotate-native.log"
|
||||
ignore(@utils.remove_file_internal(path))
|
||||
ignore(@utils.remove_file_internal(path + ".1"))
|
||||
ignore(@utils.remove_file_internal(path + ".2"))
|
||||
@@ -109,7 +109,7 @@ test "file sink can rotate on native backend" {
|
||||
///|
|
||||
#cfg(platform="windows")
|
||||
test "file sink rotation failure counts partial backup-chain failure on native backend" {
|
||||
let path = "bitlogger-rotate-partial-failure.log"
|
||||
let path = "logs/bitlogger-rotate-partial-failure.log"
|
||||
ignore(@utils.remove_file_internal(path))
|
||||
ignore(@utils.remove_file_internal(path + ".1"))
|
||||
ignore(@utils.remove_file_internal(path + ".2"))
|
||||
|
||||
@@ -81,7 +81,7 @@ test "application logger keeps configured runtime helper surface" {
|
||||
LoggerConfig::new(
|
||||
min_level=Level::Warn,
|
||||
target="app.alias.helpers",
|
||||
sink=SinkConfig::new(kind=SinkKind::File, path="app-alias.log"),
|
||||
sink=SinkConfig::new(kind=SinkKind::File, path="logs/app-alias.log"),
|
||||
queue=Some(QueueConfig::new(2, overflow=QueueOverflowPolicy::DropOldest)),
|
||||
),
|
||||
)
|
||||
@@ -229,7 +229,10 @@ test "application logger file helpers match direct configured builder behavior"
|
||||
let config = LoggerConfig::new(
|
||||
min_level=Level::Warn,
|
||||
target="app.file.same-build",
|
||||
sink=SinkConfig::new(kind=SinkKind::File, path="app-file-same-build.log"),
|
||||
sink=SinkConfig::new(
|
||||
kind=SinkKind::File,
|
||||
path="logs/app-file-same-build.log",
|
||||
),
|
||||
queue=Some(QueueConfig::new(2, overflow=QueueOverflowPolicy::DropOldest)),
|
||||
)
|
||||
let application = build_application_logger(config)
|
||||
@@ -344,7 +347,7 @@ test "application logger file controls match direct configured builder behavior"
|
||||
target="app.file.controls.same-build",
|
||||
sink=SinkConfig::new(
|
||||
kind=SinkKind::File,
|
||||
path="app-file-controls-same-build.log",
|
||||
path="logs/app-file-controls-same-build.log",
|
||||
),
|
||||
)
|
||||
let application = build_application_logger(config)
|
||||
|
||||
@@ -5,7 +5,7 @@ test "configured logger file setters stay aligned with runtime sink setters" {
|
||||
target="config.file.setters.delegate",
|
||||
sink=SinkConfig::new(
|
||||
kind=SinkKind::File,
|
||||
path="config-file-setters-delegate.log",
|
||||
path="logs/config-file-setters-delegate.log",
|
||||
),
|
||||
),
|
||||
)
|
||||
@@ -100,7 +100,7 @@ test "configured logger file reopen helpers stay aligned with runtime sink helpe
|
||||
LoggerConfig::new(
|
||||
sink=SinkConfig::new(
|
||||
kind=SinkKind::File,
|
||||
path="config-reopen-delegate.log",
|
||||
path="logs/config-reopen-delegate.log",
|
||||
),
|
||||
),
|
||||
)
|
||||
@@ -174,7 +174,7 @@ test "configured logger file reset helpers stay aligned with runtime sink helper
|
||||
LoggerConfig::new(
|
||||
sink=SinkConfig::new(
|
||||
kind=SinkKind::File,
|
||||
path="config-reset-delegate.log",
|
||||
path="logs/config-reset-delegate.log",
|
||||
append=false,
|
||||
auto_flush=false,
|
||||
rotation=Some(file_rotation(40, max_backups=2)),
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
test "configured logger file setters update file sink policy state" {
|
||||
let logger = build_logger(
|
||||
LoggerConfig::new(
|
||||
sink=SinkConfig::new(kind=SinkKind::File, path="config-setters.log"),
|
||||
sink=SinkConfig::new(kind=SinkKind::File, path="logs/config-setters.log"),
|
||||
queue=Some(QueueConfig::new(2, overflow=QueueOverflowPolicy::DropNewest)),
|
||||
),
|
||||
)
|
||||
@@ -61,7 +61,7 @@ test "configured logger reset policy restores configured file defaults" {
|
||||
LoggerConfig::new(
|
||||
sink=SinkConfig::new(
|
||||
kind=SinkKind::File,
|
||||
path="config-reset-policy.log",
|
||||
path="logs/config-reset-policy.log",
|
||||
append=false,
|
||||
auto_flush=false,
|
||||
rotation=Some(file_rotation(36, max_backups=2)),
|
||||
@@ -93,7 +93,10 @@ test "configured logger reset policy restores configured file defaults" {
|
||||
test "configured logger set policy applies bundled runtime file policy" {
|
||||
let logger = build_logger(
|
||||
LoggerConfig::new(
|
||||
sink=SinkConfig::new(kind=SinkKind::File, path="config-set-policy.log"),
|
||||
sink=SinkConfig::new(
|
||||
kind=SinkKind::File,
|
||||
path="logs/config-set-policy.log",
|
||||
),
|
||||
),
|
||||
)
|
||||
let default_policy = logger.file_default_policy()
|
||||
@@ -140,7 +143,7 @@ test "configured non-file logger cannot reset file policy" {
|
||||
test "configured logger can reopen built file sink" {
|
||||
let logger = build_logger(
|
||||
LoggerConfig::new(
|
||||
sink=SinkConfig::new(kind=SinkKind::File, path="config-reopen.log"),
|
||||
sink=SinkConfig::new(kind=SinkKind::File, path="logs/config-reopen.log"),
|
||||
),
|
||||
)
|
||||
if logger.file_available() {
|
||||
@@ -199,7 +202,7 @@ test "configured non-file logger cannot reset file failure counters" {
|
||||
test "configured logger exposes file flush and close helpers" {
|
||||
let logger = build_logger(
|
||||
LoggerConfig::new(
|
||||
sink=SinkConfig::new(kind=SinkKind::File, path="config-control.log"),
|
||||
sink=SinkConfig::new(kind=SinkKind::File, path="logs/config-control.log"),
|
||||
),
|
||||
)
|
||||
if logger.file_available() {
|
||||
@@ -218,7 +221,10 @@ test "configured logger exposes file flush and close helpers" {
|
||||
test "configured queued file logger flushes queue through file helper" {
|
||||
let logger = build_logger(
|
||||
LoggerConfig::new(
|
||||
sink=SinkConfig::new(kind=SinkKind::File, path="config-queued-file.log"),
|
||||
sink=SinkConfig::new(
|
||||
kind=SinkKind::File,
|
||||
path="logs/config-queued-file.log",
|
||||
),
|
||||
queue=Some(QueueConfig::new(4, overflow=QueueOverflowPolicy::DropNewest)),
|
||||
),
|
||||
)
|
||||
@@ -257,7 +263,10 @@ test "configured queued file logger flushes queue through file helper" {
|
||||
test "configured queued file logger blocks policy mutation while queue is pending" {
|
||||
let logger = build_logger(
|
||||
LoggerConfig::new(
|
||||
sink=SinkConfig::new(kind=SinkKind::File, path="config-queued-policy.log"),
|
||||
sink=SinkConfig::new(
|
||||
kind=SinkKind::File,
|
||||
path="logs/config-queued-policy.log",
|
||||
),
|
||||
queue=Some(QueueConfig::new(4, overflow=QueueOverflowPolicy::DropNewest)),
|
||||
),
|
||||
)
|
||||
@@ -293,7 +302,10 @@ test "configured queued file logger blocks policy mutation while queue is pendin
|
||||
test "configured queued file logger close drains queue before teardown" {
|
||||
let logger = build_logger(
|
||||
LoggerConfig::new(
|
||||
sink=SinkConfig::new(kind=SinkKind::File, path="config-close-queued.log"),
|
||||
sink=SinkConfig::new(
|
||||
kind=SinkKind::File,
|
||||
path="logs/config-close-queued.log",
|
||||
),
|
||||
queue=Some(QueueConfig::new(4, overflow=QueueOverflowPolicy::DropNewest)),
|
||||
),
|
||||
)
|
||||
|
||||
@@ -3,7 +3,10 @@ test "configured logger file observation helpers stay aligned with runtime sink
|
||||
let file_logger = build_logger(
|
||||
LoggerConfig::new(
|
||||
target="config.file.delegate",
|
||||
sink=SinkConfig::new(kind=SinkKind::File, path="config-file-delegate.log"),
|
||||
sink=SinkConfig::new(
|
||||
kind=SinkKind::File,
|
||||
path="logs/config-file-delegate.log",
|
||||
),
|
||||
),
|
||||
)
|
||||
let file_sink = file_logger.sink
|
||||
@@ -74,7 +77,7 @@ test "configured logger file policy helpers stay aligned with runtime sink helpe
|
||||
target="config.file.policy.delegate",
|
||||
sink=SinkConfig::new(
|
||||
kind=SinkKind::File,
|
||||
path="config-file-policy-delegate.log",
|
||||
path="logs/config-file-policy-delegate.log",
|
||||
append=false,
|
||||
auto_flush=true,
|
||||
rotation=Some(file_rotation(64, max_backups=2)),
|
||||
@@ -213,7 +216,7 @@ test "configured logger file flush and close stay aligned with runtime sink help
|
||||
let file_config = LoggerConfig::new(
|
||||
sink=SinkConfig::new(
|
||||
kind=SinkKind::File,
|
||||
path="config-file-helper-delegate.log",
|
||||
path="logs/config-file-helper-delegate.log",
|
||||
),
|
||||
)
|
||||
let file_logger = build_logger(file_config)
|
||||
@@ -245,7 +248,7 @@ test "configured logger file state helpers stay aligned with runtime sink helper
|
||||
target="config.file.state.delegate",
|
||||
sink=SinkConfig::new(
|
||||
kind=SinkKind::File,
|
||||
path="config-file-state-delegate.log",
|
||||
path="logs/config-file-state-delegate.log",
|
||||
),
|
||||
),
|
||||
)
|
||||
@@ -297,7 +300,7 @@ test "configured logger file state helpers stay aligned with runtime sink helper
|
||||
target="config.file.runtime.delegate",
|
||||
sink=SinkConfig::new(
|
||||
kind=SinkKind::File,
|
||||
path="config-file-runtime-delegate.log",
|
||||
path="logs/config-file-runtime-delegate.log",
|
||||
),
|
||||
queue=Some(QueueConfig::new(4, overflow=QueueOverflowPolicy::DropNewest)),
|
||||
),
|
||||
|
||||
@@ -4,7 +4,7 @@ test "configured logger exposes file sink observability helpers" {
|
||||
LoggerConfig::new(
|
||||
sink=SinkConfig::new(
|
||||
kind=SinkKind::File,
|
||||
path="config-file.log",
|
||||
path="logs/config-file.log",
|
||||
auto_flush=false,
|
||||
rotation=Some(file_rotation(64, max_backups=3)),
|
||||
),
|
||||
@@ -13,8 +13,8 @@ test "configured logger exposes file sink observability helpers" {
|
||||
let state = logger.file_state()
|
||||
let runtime_state = logger.file_runtime_state()
|
||||
inspect(logger.file_available() == native_files_supported(), content="true")
|
||||
inspect(logger.file_path(), content="config-file.log")
|
||||
inspect(state.path, content="config-file.log")
|
||||
inspect(logger.file_path(), content="logs/config-file.log")
|
||||
inspect(state.path, content="logs/config-file.log")
|
||||
inspect(state.available == logger.file_available(), content="true")
|
||||
inspect(state.append == logger.file_append_mode(), content="true")
|
||||
inspect(state.auto_flush == logger.file_auto_flush(), content="true")
|
||||
@@ -25,7 +25,7 @@ test "configured logger exposes file sink observability helpers" {
|
||||
inspect(snapshot.queued, content="false")
|
||||
inspect(snapshot.pending_count, content="0")
|
||||
inspect(snapshot.dropped_count, content="0")
|
||||
inspect(snapshot.file.path, content="config-file.log")
|
||||
inspect(snapshot.file.path, content="logs/config-file.log")
|
||||
}
|
||||
None => inspect(false, content="true")
|
||||
}
|
||||
@@ -51,7 +51,10 @@ test "configured logger exposes file sink observability helpers" {
|
||||
test "configured logger reports disabled rotation when file sink has none" {
|
||||
let logger = build_logger(
|
||||
LoggerConfig::new(
|
||||
sink=SinkConfig::new(kind=SinkKind::File, path="config-no-rotation.log"),
|
||||
sink=SinkConfig::new(
|
||||
kind=SinkKind::File,
|
||||
path="logs/config-no-rotation.log",
|
||||
),
|
||||
),
|
||||
)
|
||||
inspect(logger.file_rotation_enabled(), content="false")
|
||||
@@ -79,12 +82,15 @@ test "configured non-file logger has no file runtime state" {
|
||||
test "configured file logger mirrors backend file capability" {
|
||||
let logger = build_logger(
|
||||
LoggerConfig::new(
|
||||
sink=SinkConfig::new(kind=SinkKind::File, path="config-capability.log"),
|
||||
sink=SinkConfig::new(
|
||||
kind=SinkKind::File,
|
||||
path="logs/config-capability.log",
|
||||
),
|
||||
),
|
||||
)
|
||||
inspect(logger.file_available() == native_files_supported(), content="true")
|
||||
match logger.file_path_or_none() {
|
||||
Some(path) => inspect(path, content="config-capability.log")
|
||||
Some(path) => inspect(path, content="logs/config-capability.log")
|
||||
None => inspect(false, content="true")
|
||||
}
|
||||
inspect(logger.file_policy_or_none() is None, content="false")
|
||||
|
||||
@@ -82,7 +82,10 @@ test "configured logger projection preserves file runtime helpers through unwrap
|
||||
LoggerConfig::new(
|
||||
min_level=Level::Warn,
|
||||
target="lib.projected.file",
|
||||
sink=SinkConfig::new(kind=SinkKind::File, path="lib-projected-file.log"),
|
||||
sink=SinkConfig::new(
|
||||
kind=SinkKind::File,
|
||||
path="logs/lib-projected-file.log",
|
||||
),
|
||||
queue=Some(QueueConfig::new(2, overflow=QueueOverflowPolicy::DropOldest)),
|
||||
),
|
||||
)
|
||||
|
||||
+11
-8
@@ -8,11 +8,11 @@ test "native file support flag is queryable" {
|
||||
|
||||
///|
|
||||
test "file sink availability reflects backend support" {
|
||||
let sink = file_sink("bitlogger-test.log")
|
||||
let sink = file_sink("logs/bitlogger-test.log")
|
||||
let state = sink.state()
|
||||
inspect(sink.path(), content="bitlogger-test.log")
|
||||
inspect(sink.path(), content="logs/bitlogger-test.log")
|
||||
inspect(sink.is_available() == native_files_supported(), content="true")
|
||||
inspect(state.path, content="bitlogger-test.log")
|
||||
inspect(state.path, content="logs/bitlogger-test.log")
|
||||
inspect(state.available == sink.is_available(), content="true")
|
||||
inspect(state.append == sink.append_mode(), content="true")
|
||||
inspect(state.auto_flush == sink.auto_flush_enabled(), content="true")
|
||||
@@ -42,7 +42,7 @@ test "file sink availability reflects backend support" {
|
||||
///|
|
||||
test "file sink unavailable backend keeps stable fallback state" {
|
||||
let sink = file_sink(
|
||||
"bitlogger-unavailable.log",
|
||||
"logs/bitlogger-unavailable.log",
|
||||
rotation=Some(file_rotation(64, max_backups=2)),
|
||||
)
|
||||
if sink.is_available() {
|
||||
@@ -73,7 +73,10 @@ test "file sink rotation config normalizes invalid inputs" {
|
||||
let rotation = file_rotation(0, max_backups=0)
|
||||
inspect(rotation.max_bytes, content="1")
|
||||
inspect(rotation.max_backups, content="1")
|
||||
let sink = file_sink("bitlogger-rotation-config.log", rotation=Some(rotation))
|
||||
let sink = file_sink(
|
||||
"logs/bitlogger-rotation-config.log",
|
||||
rotation=Some(rotation),
|
||||
)
|
||||
inspect(sink.rotation_enabled(), content="true")
|
||||
match sink.rotation_config() {
|
||||
Some(config) => {
|
||||
@@ -97,7 +100,7 @@ test "file rotation i64 preserves wide threshold metadata" {
|
||||
|
||||
///|
|
||||
test "file sink setters update auto flush and rotation state" {
|
||||
let sink = file_sink("bitlogger-setters.log")
|
||||
let sink = file_sink("logs/bitlogger-setters.log")
|
||||
let default_policy = sink.default_policy()
|
||||
inspect(sink.append_mode(), content="true")
|
||||
inspect(sink.auto_flush_enabled(), content="true")
|
||||
@@ -146,7 +149,7 @@ test "file sink setters update auto flush and rotation state" {
|
||||
///|
|
||||
test "file sink reset policy restores configured defaults" {
|
||||
let sink = file_sink(
|
||||
"bitlogger-reset-policy.log",
|
||||
"logs/bitlogger-reset-policy.log",
|
||||
append=false,
|
||||
auto_flush=false,
|
||||
rotation=Some(file_rotation(24, max_backups=3)),
|
||||
@@ -173,7 +176,7 @@ test "file sink reset policy restores configured defaults" {
|
||||
|
||||
///|
|
||||
test "file sink set policy applies bundled runtime policy" {
|
||||
let sink = file_sink("bitlogger-set-policy.log")
|
||||
let sink = file_sink("logs/bitlogger-set-policy.log")
|
||||
let default_policy = sink.default_policy()
|
||||
sink.set_policy(
|
||||
FileSinkPolicy::new(
|
||||
|
||||
@@ -164,7 +164,10 @@ test "library logger builder unwrap preserves file runtime helpers" {
|
||||
let config = LoggerConfig::new(
|
||||
min_level=Level::Warn,
|
||||
target="lib.file.same-build",
|
||||
sink=SinkConfig::new(kind=SinkKind::File, path="lib-file-same-build.log"),
|
||||
sink=SinkConfig::new(
|
||||
kind=SinkKind::File,
|
||||
path="logs/lib-file-same-build.log",
|
||||
),
|
||||
queue=Some(QueueConfig::new(2, overflow=QueueOverflowPolicy::DropOldest)),
|
||||
)
|
||||
let logger = build_library_logger(config)
|
||||
@@ -236,7 +239,7 @@ test "library logger builder unwrap preserves file controls" {
|
||||
target="lib.file.controls.same-build",
|
||||
sink=SinkConfig::new(
|
||||
kind=SinkKind::File,
|
||||
path="lib-file-controls-same-build.log",
|
||||
path="logs/lib-file-controls-same-build.log",
|
||||
),
|
||||
)
|
||||
let logger = build_library_logger(config)
|
||||
|
||||
@@ -30,7 +30,7 @@ test "config subtype json helpers stringify stable shapes" {
|
||||
stringify_sink_config(
|
||||
SinkConfig::new(
|
||||
kind=SinkKind::File,
|
||||
path="demo.log",
|
||||
path="logs/demo.log",
|
||||
append=false,
|
||||
auto_flush=false,
|
||||
rotation=Some(file_rotation(128, max_backups=2)),
|
||||
@@ -40,7 +40,7 @@ test "config subtype json helpers stringify stable shapes" {
|
||||
),
|
||||
),
|
||||
),
|
||||
content="{\"kind\":\"file\",\"path\":\"demo.log\",\"append\":false,\"auto_flush\":false,\"text_formatter\":{\"show_timestamp\":false,\"show_level\":true,\"show_target\":true,\"show_fields\":true,\"separator\":\" \",\"field_separator\":\" \",\"template\":\"\",\"color_mode\":\"auto\",\"color_support\":\"truecolor\",\"style_markup\":\"full\",\"target_style_markup\":\"disabled\",\"fields_style_markup\":\"disabled\"},\"rotation\":{\"max_bytes\":128,\"max_backups\":2}}",
|
||||
content="{\"kind\":\"file\",\"path\":\"logs/demo.log\",\"append\":false,\"auto_flush\":false,\"text_formatter\":{\"show_timestamp\":false,\"show_level\":true,\"show_target\":true,\"show_fields\":true,\"separator\":\" \",\"field_separator\":\" \",\"template\":\"\",\"color_mode\":\"auto\",\"color_support\":\"truecolor\",\"style_markup\":\"full\",\"target_style_markup\":\"disabled\",\"fields_style_markup\":\"disabled\"},\"rotation\":{\"max_bytes\":128,\"max_backups\":2}}",
|
||||
)
|
||||
inspect(
|
||||
@json_parser.stringify(
|
||||
@@ -141,7 +141,7 @@ test "config json helpers export stable structured shapes" {
|
||||
let sink_json = sink_config_to_json(
|
||||
SinkConfig::new(
|
||||
kind=SinkKind::File,
|
||||
path="demo.log",
|
||||
path="logs/demo.log",
|
||||
append=false,
|
||||
auto_flush=false,
|
||||
rotation=Some(file_rotation(128, max_backups=2)),
|
||||
@@ -161,7 +161,7 @@ test "config json helpers export stable structured shapes" {
|
||||
inspect(sink_obj.get("kind").unwrap().as_string().unwrap(), content="file")
|
||||
inspect(
|
||||
sink_obj.get("path").unwrap().as_string().unwrap(),
|
||||
content="demo.log",
|
||||
content="logs/demo.log",
|
||||
)
|
||||
inspect(sink_obj.get("append").unwrap().as_bool().unwrap(), content="false")
|
||||
inspect(
|
||||
|
||||
@@ -45,7 +45,7 @@ test "logger config parser reads formatter and queue options" {
|
||||
///|
|
||||
test "logger config parser reads file rotation options" {
|
||||
let config = parse_logger_config_text(
|
||||
"{\"sink\":{\"kind\":\"file\",\"path\":\"bitlogger.log\",\"rotation\":{\"max_bytes\":128,\"max_backups\":3}}}",
|
||||
"{\"sink\":{\"kind\":\"file\",\"path\":\"logs/bitlogger.log\",\"rotation\":{\"max_bytes\":128,\"max_backups\":3}}}",
|
||||
)
|
||||
inspect(
|
||||
match config.sink.kind {
|
||||
@@ -54,7 +54,7 @@ test "logger config parser reads file rotation options" {
|
||||
},
|
||||
content="File",
|
||||
)
|
||||
inspect(config.sink.path, content="bitlogger.log")
|
||||
inspect(config.sink.path, content="logs/bitlogger.log")
|
||||
match config.sink.rotation {
|
||||
Some(rotation) => {
|
||||
inspect(rotation.max_bytes, content="128")
|
||||
@@ -68,9 +68,9 @@ test "logger config parser reads file rotation options" {
|
||||
///|
|
||||
test "logger config parser prefers max_bytes_i64 when present" {
|
||||
let config = parse_logger_config_text(
|
||||
"{\"sink\":{\"kind\":\"file\",\"path\":\"bitlogger.log\",\"rotation\":{\"max_bytes\":128,\"max_bytes_i64\":\"4294967296\",\"max_backups\":3}}}",
|
||||
"{\"sink\":{\"kind\":\"file\",\"path\":\"logs/bitlogger.log\",\"rotation\":{\"max_bytes\":128,\"max_bytes_i64\":\"4294967296\",\"max_backups\":3}}}",
|
||||
)
|
||||
inspect(config.sink.path, content="bitlogger.log")
|
||||
inspect(config.sink.path, content="logs/bitlogger.log")
|
||||
match config.sink.rotation {
|
||||
Some(rotation) => {
|
||||
inspect(rotation.max_bytes, content="2147483647")
|
||||
|
||||
@@ -43,13 +43,13 @@ test "logger config stringify roundtrips file rotation fields" {
|
||||
LoggerConfig::new(
|
||||
sink=SinkConfig::new(
|
||||
kind=SinkKind::File,
|
||||
path="bitlogger.log",
|
||||
path="logs/bitlogger.log",
|
||||
rotation=Some(file_rotation(256, max_backups=2)),
|
||||
),
|
||||
),
|
||||
)
|
||||
let config = parse_logger_config_text(text)
|
||||
inspect(config.sink.path, content="bitlogger.log")
|
||||
inspect(config.sink.path, content="logs/bitlogger.log")
|
||||
match config.sink.rotation {
|
||||
Some(rotation) => {
|
||||
inspect(rotation.max_bytes, content="256")
|
||||
@@ -66,13 +66,13 @@ test "logger config stringify roundtrips file rotation i64 metadata" {
|
||||
LoggerConfig::new(
|
||||
sink=SinkConfig::new(
|
||||
kind=SinkKind::File,
|
||||
path="bitlogger.log",
|
||||
path="logs/bitlogger.log",
|
||||
rotation=Some(file_rotation_i64(4294967296L, max_backups=2)),
|
||||
),
|
||||
),
|
||||
)
|
||||
let config = parse_logger_config_text(text)
|
||||
inspect(config.sink.path, content="bitlogger.log")
|
||||
inspect(config.sink.path, content="logs/bitlogger.log")
|
||||
match config.sink.rotation {
|
||||
Some(rotation) => {
|
||||
inspect(rotation.max_bytes, content="2147483647")
|
||||
|
||||
@@ -147,7 +147,7 @@ test "application logger parse-build matches parsed direct builder behavior" {
|
||||
///|
|
||||
test "parsed application logger keeps direct runtime helper surface" {
|
||||
let logger : ApplicationLogger = parse_and_build_application_logger(
|
||||
"{\"min_level\":\"warn\",\"target\":\"app.json.helpers\",\"queue\":{\"max_pending\":2,\"overflow\":\"DropOldest\"},\"sink\":{\"kind\":\"file\",\"path\":\"app-json-helpers.log\"}}",
|
||||
"{\"min_level\":\"warn\",\"target\":\"app.json.helpers\",\"queue\":{\"max_pending\":2,\"overflow\":\"DropOldest\"},\"sink\":{\"kind\":\"file\",\"path\":\"logs/app-json-helpers.log\"}}",
|
||||
)
|
||||
|
||||
logger.error("one")
|
||||
|
||||
@@ -143,7 +143,7 @@ test "library logger parse-build unwrap matches parsed direct builder behavior"
|
||||
|
||||
///|
|
||||
test "library logger parse-build unwrap preserves file runtime helpers" {
|
||||
let raw = "{\"min_level\":\"warn\",\"target\":\"lib.json.file.same-build\",\"queue\":{\"max_pending\":2,\"overflow\":\"DropOldest\"},\"sink\":{\"kind\":\"file\",\"path\":\"lib-json-file-same-build.log\"}}"
|
||||
let raw = "{\"min_level\":\"warn\",\"target\":\"lib.json.file.same-build\",\"queue\":{\"max_pending\":2,\"overflow\":\"DropOldest\"},\"sink\":{\"kind\":\"file\",\"path\":\"logs/lib-json-file-same-build.log\"}}"
|
||||
let logger = parse_and_build_library_logger(raw)
|
||||
let full = logger.to_logger()
|
||||
let configured = parse_and_build_logger(raw)
|
||||
@@ -208,7 +208,7 @@ test "library logger parse-build unwrap preserves file runtime helpers" {
|
||||
|
||||
///|
|
||||
test "library logger parse-build unwrap preserves file controls" {
|
||||
let raw = "{\"min_level\":\"warn\",\"target\":\"lib.json.file.controls.same-build\",\"sink\":{\"kind\":\"file\",\"path\":\"lib-json-file-controls-same-build.log\"}}"
|
||||
let raw = "{\"min_level\":\"warn\",\"target\":\"lib.json.file.controls.same-build\",\"sink\":{\"kind\":\"file\",\"path\":\"logs/lib-json-file-controls-same-build.log\"}}"
|
||||
let logger = parse_and_build_library_logger(raw)
|
||||
let full = logger.to_logger()
|
||||
let configured = parse_and_build_logger(raw)
|
||||
|
||||
+12
-8
@@ -40,7 +40,7 @@ test "logger config presets use expected defaults" {
|
||||
|
||||
///|
|
||||
test "file preset uses file sink defaults" {
|
||||
let config = file("bitlogger.log")
|
||||
let config = file("logs/bitlogger.log")
|
||||
inspect(config.min_level.label(), content="INFO")
|
||||
inspect(config.target, content="")
|
||||
inspect(config.timestamp, content="false")
|
||||
@@ -51,7 +51,7 @@ test "file preset uses file sink defaults" {
|
||||
},
|
||||
content="File",
|
||||
)
|
||||
inspect(config.sink.path, content="bitlogger.log")
|
||||
inspect(config.sink.path, content="logs/bitlogger.log")
|
||||
inspect(config.sink.append, content="true")
|
||||
inspect(config.sink.auto_flush, content="true")
|
||||
inspect(config.sink.rotation is None, content="true")
|
||||
@@ -86,7 +86,7 @@ test "preset helpers compose queue and file rotation without losing config" {
|
||||
separator=" | ",
|
||||
)
|
||||
let config = file(
|
||||
"service.log",
|
||||
"logs/service.log",
|
||||
min_level=Level::Warn,
|
||||
target="svc.worker",
|
||||
timestamp=true,
|
||||
@@ -102,7 +102,7 @@ test "preset helpers compose queue and file rotation without losing config" {
|
||||
inspect(config.min_level.label(), content="WARN")
|
||||
inspect(config.target, content="svc.worker")
|
||||
inspect(config.timestamp, content="true")
|
||||
inspect(config.sink.path, content="service.log")
|
||||
inspect(config.sink.path, content="logs/service.log")
|
||||
inspect(config.sink.append, content="false")
|
||||
inspect(config.sink.auto_flush, content="false")
|
||||
inspect(config.sink.text_formatter.show_timestamp, content="false")
|
||||
@@ -132,11 +132,15 @@ test "preset helpers compose queue and file rotation without losing config" {
|
||||
///|
|
||||
test "queue helper preserves file rotation when applied after rotation" {
|
||||
let config = with_queue(
|
||||
with_file_rotation(file("service.log", append=false), 256, max_backups=2),
|
||||
with_file_rotation(
|
||||
file("logs/service.log", append=false),
|
||||
256,
|
||||
max_backups=2,
|
||||
),
|
||||
max_pending=8,
|
||||
overflow=QueueOverflowPolicy::DropNewest,
|
||||
)
|
||||
inspect(config.sink.path, content="service.log")
|
||||
inspect(config.sink.path, content="logs/service.log")
|
||||
inspect(config.sink.append, content="false")
|
||||
match config.queue {
|
||||
Some(queue) => {
|
||||
@@ -163,11 +167,11 @@ test "queue helper preserves file rotation when applied after rotation" {
|
||||
///|
|
||||
test "file rotation i64 helper preserves file preset shape" {
|
||||
let config = with_file_rotation_i64(
|
||||
with_queue(file("service.log", append=false), max_pending=8),
|
||||
with_queue(file("logs/service.log", append=false), max_pending=8),
|
||||
4294967296L,
|
||||
max_backups=2,
|
||||
)
|
||||
inspect(config.sink.path, content="service.log")
|
||||
inspect(config.sink.path, content="logs/service.log")
|
||||
inspect(config.sink.append, content="false")
|
||||
match config.sink.rotation {
|
||||
Some(rotation) => {
|
||||
|
||||
@@ -29,7 +29,7 @@ test "file state json helpers stringify stable snapshots" {
|
||||
|
||||
let plain = file_sink_state_to_json(
|
||||
FileSinkState::new(
|
||||
"demo.log",
|
||||
"logs/demo.log",
|
||||
available=true,
|
||||
append=false,
|
||||
auto_flush=true,
|
||||
@@ -48,11 +48,11 @@ test "file state json helpers stringify stable snapshots" {
|
||||
.unwrap()
|
||||
inspect(
|
||||
@json_parser.stringify(plain),
|
||||
content="{\"path\":\"demo.log\",\"available\":true,\"append\":false,\"auto_flush\":true,\"open_failures\":1,\"write_failures\":2,\"flush_failures\":3,\"rotation_failures\":4,\"rotation\":{\"max_bytes\":64,\"max_backups\":2}}",
|
||||
content="{\"path\":\"logs/demo.log\",\"available\":true,\"append\":false,\"auto_flush\":true,\"open_failures\":1,\"write_failures\":2,\"flush_failures\":3,\"rotation_failures\":4,\"rotation\":{\"max_bytes\":64,\"max_backups\":2}}",
|
||||
)
|
||||
inspect(
|
||||
plain_obj.get("path").unwrap().as_string().unwrap(),
|
||||
content="demo.log",
|
||||
content="logs/demo.log",
|
||||
)
|
||||
inspect(
|
||||
plain_obj.get("available").unwrap().as_bool().unwrap(),
|
||||
@@ -90,7 +90,7 @@ test "file state json helpers stringify stable snapshots" {
|
||||
|
||||
let wide = file_sink_state_to_json(
|
||||
FileSinkState::new(
|
||||
"wide.log",
|
||||
"logs/wide.log",
|
||||
available=true,
|
||||
append=true,
|
||||
auto_flush=false,
|
||||
@@ -132,7 +132,7 @@ test "file state json helpers stringify stable snapshots" {
|
||||
inspect(
|
||||
stringify_file_sink_state(
|
||||
FileSinkState::new(
|
||||
"plain.log",
|
||||
"logs/plain.log",
|
||||
available=false,
|
||||
append=true,
|
||||
auto_flush=false,
|
||||
@@ -143,7 +143,7 @@ test "file state json helpers stringify stable snapshots" {
|
||||
rotation_failures=0,
|
||||
),
|
||||
),
|
||||
content="{\"path\":\"plain.log\",\"available\":false,\"append\":true,\"auto_flush\":false,\"open_failures\":0,\"write_failures\":0,\"flush_failures\":0,\"rotation_failures\":0,\"rotation\":null}",
|
||||
content="{\"path\":\"logs/plain.log\",\"available\":false,\"append\":true,\"auto_flush\":false,\"open_failures\":0,\"write_failures\":0,\"flush_failures\":0,\"rotation_failures\":0,\"rotation\":null}",
|
||||
)
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ test "runtime file state json helpers stringify queue snapshots" {
|
||||
let runtime_json = runtime_file_state_to_json(
|
||||
RuntimeFileState::new(
|
||||
FileSinkState::new(
|
||||
"queue.log",
|
||||
"logs/queue.log",
|
||||
available=true,
|
||||
append=true,
|
||||
auto_flush=false,
|
||||
@@ -180,7 +180,7 @@ test "runtime file state json helpers stringify queue snapshots" {
|
||||
)
|
||||
inspect(
|
||||
runtime_file_obj.get("path").unwrap().as_string().unwrap(),
|
||||
content="queue.log",
|
||||
content="logs/queue.log",
|
||||
)
|
||||
inspect(
|
||||
runtime_file_obj.get("available").unwrap().as_bool().unwrap(),
|
||||
@@ -194,7 +194,7 @@ test "runtime file state json helpers stringify queue snapshots" {
|
||||
let json = stringify_runtime_file_state(
|
||||
RuntimeFileState::new(
|
||||
FileSinkState::new(
|
||||
"queue.log",
|
||||
"logs/queue.log",
|
||||
available=true,
|
||||
append=true,
|
||||
auto_flush=false,
|
||||
@@ -211,13 +211,13 @@ test "runtime file state json helpers stringify queue snapshots" {
|
||||
)
|
||||
inspect(
|
||||
json,
|
||||
content="{\"file\":{\"path\":\"queue.log\",\"available\":true,\"append\":true,\"auto_flush\":false,\"open_failures\":0,\"write_failures\":1,\"flush_failures\":2,\"rotation_failures\":3,\"rotation\":null},\"queued\":true,\"pending_count\":7,\"dropped_count\":5}",
|
||||
content="{\"file\":{\"path\":\"logs/queue.log\",\"available\":true,\"append\":true,\"auto_flush\":false,\"open_failures\":0,\"write_failures\":1,\"flush_failures\":2,\"rotation_failures\":3,\"rotation\":null},\"queued\":true,\"pending_count\":7,\"dropped_count\":5}",
|
||||
)
|
||||
|
||||
let wide_runtime_json = runtime_file_state_to_json(
|
||||
RuntimeFileState::new(
|
||||
FileSinkState::new(
|
||||
"wide-queue.log",
|
||||
"logs/wide-queue.log",
|
||||
available=true,
|
||||
append=true,
|
||||
auto_flush=true,
|
||||
|
||||
@@ -16,7 +16,7 @@ test "configured logger close stays aligned with runtime sink close" {
|
||||
|
||||
let file_config = LoggerConfig::new(
|
||||
target="config.close.file",
|
||||
sink=SinkConfig::new(kind=SinkKind::File, path="config-close.log"),
|
||||
sink=SinkConfig::new(kind=SinkKind::File, path="logs/config-close.log"),
|
||||
)
|
||||
let file_logger = build_logger(file_config)
|
||||
let file_sink = build_logger(file_config).sink
|
||||
@@ -110,7 +110,7 @@ test "configured queued console close drains pending queue" {
|
||||
test "runtime sink queued file close drains queue before teardown" {
|
||||
let sink = RuntimeSink::QueuedFile(
|
||||
queued_sink(
|
||||
file_sink("runtime-close-queued.log", auto_flush=false),
|
||||
file_sink("logs/runtime-close-queued.log", auto_flush=false),
|
||||
max_pending=4,
|
||||
),
|
||||
)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
///|
|
||||
test "runtime sink plain file reopen helpers and failure resets work directly" {
|
||||
let sink = RuntimeSink::File(file_sink("runtime-reopen-direct.log"))
|
||||
let sink = RuntimeSink::File(file_sink("logs/runtime-reopen-direct.log"))
|
||||
if sink.file_available() {
|
||||
inspect(sink.close(), content="true")
|
||||
inspect(sink.file_reopen_append(), content="true")
|
||||
@@ -52,7 +52,7 @@ test "runtime sink plain file reopen helpers and failure resets work directly" {
|
||||
///|
|
||||
test "runtime sink queued file reopen helpers and failure resets work directly" {
|
||||
let sink = RuntimeSink::QueuedFile(
|
||||
queued_sink(file_sink("runtime-reopen-queued.log"), max_pending=2),
|
||||
queued_sink(file_sink("logs/runtime-reopen-queued.log"), max_pending=2),
|
||||
)
|
||||
if sink.file_available() {
|
||||
inspect(sink.file_close(), content="true")
|
||||
|
||||
@@ -7,7 +7,7 @@ test "runtime sink plain variants use documented fallback counts" {
|
||||
inspect(console_sink.drain(), content="0")
|
||||
|
||||
let file_sink = RuntimeSink::File(
|
||||
file_sink("runtime-direct.log", auto_flush=false),
|
||||
file_sink("logs/runtime-direct.log", auto_flush=false),
|
||||
)
|
||||
inspect(file_sink.pending_count(), content="0")
|
||||
inspect(file_sink.dropped_count(), content="0")
|
||||
@@ -81,17 +81,17 @@ test "runtime sink non-file variants expose documented file fallbacks" {
|
||||
test "runtime sink plain file helpers expose direct file state and policy" {
|
||||
let sink = RuntimeSink::File(
|
||||
file_sink(
|
||||
"runtime-file-helpers.log",
|
||||
"logs/runtime-file-helpers.log",
|
||||
auto_flush=false,
|
||||
rotation=Some(file_rotation(40, max_backups=2)),
|
||||
),
|
||||
)
|
||||
inspect(sink.file_available() == native_files_supported(), content="true")
|
||||
match sink.file_path_or_none() {
|
||||
Some(path) => inspect(path, content="runtime-file-helpers.log")
|
||||
Some(path) => inspect(path, content="logs/runtime-file-helpers.log")
|
||||
None => inspect(false, content="true")
|
||||
}
|
||||
inspect(sink.file_path(), content="runtime-file-helpers.log")
|
||||
inspect(sink.file_path(), content="logs/runtime-file-helpers.log")
|
||||
inspect(sink.file_append_mode(), content="true")
|
||||
inspect(sink.file_auto_flush(), content="false")
|
||||
inspect(sink.file_rotation_enabled(), content="true")
|
||||
@@ -125,14 +125,14 @@ test "runtime sink plain file helpers expose direct file state and policy" {
|
||||
}
|
||||
match sink.file_state_or_none() {
|
||||
Some(snapshot) => {
|
||||
inspect(snapshot.path, content="runtime-file-helpers.log")
|
||||
inspect(snapshot.path, content="logs/runtime-file-helpers.log")
|
||||
inspect(snapshot.append, content="true")
|
||||
inspect(snapshot.auto_flush, content="false")
|
||||
}
|
||||
None => inspect(false, content="true")
|
||||
}
|
||||
let state = sink.file_state()
|
||||
inspect(state.path, content="runtime-file-helpers.log")
|
||||
inspect(state.path, content="logs/runtime-file-helpers.log")
|
||||
inspect(state.available == sink.file_available(), content="true")
|
||||
inspect(state.append, content="true")
|
||||
inspect(state.auto_flush, content="false")
|
||||
@@ -141,7 +141,7 @@ test "runtime sink plain file helpers expose direct file state and policy" {
|
||||
inspect(snapshot.queued, content="false")
|
||||
inspect(snapshot.pending_count, content="0")
|
||||
inspect(snapshot.dropped_count, content="0")
|
||||
inspect(snapshot.file.path, content="runtime-file-helpers.log")
|
||||
inspect(snapshot.file.path, content="logs/runtime-file-helpers.log")
|
||||
}
|
||||
None => inspect(false, content="true")
|
||||
}
|
||||
@@ -170,7 +170,7 @@ test "runtime sink plain file helpers expose direct file state and policy" {
|
||||
test "runtime sink queued file helpers preserve queue-aware file runtime state" {
|
||||
let sink = RuntimeSink::QueuedFile(
|
||||
queued_sink(
|
||||
file_sink("runtime-queued-file.log", auto_flush=false),
|
||||
file_sink("logs/runtime-queued-file.log", auto_flush=false),
|
||||
max_pending=2,
|
||||
overflow=QueueOverflowPolicy::DropNewest,
|
||||
),
|
||||
@@ -185,10 +185,10 @@ test "runtime sink queued file helpers preserve queue-aware file runtime state"
|
||||
logger.info("three")
|
||||
inspect(sink.file_available() == native_files_supported(), content="true")
|
||||
match sink.file_path_or_none() {
|
||||
Some(path) => inspect(path, content="runtime-queued-file.log")
|
||||
Some(path) => inspect(path, content="logs/runtime-queued-file.log")
|
||||
None => inspect(false, content="true")
|
||||
}
|
||||
inspect(sink.file_path(), content="runtime-queued-file.log")
|
||||
inspect(sink.file_path(), content="logs/runtime-queued-file.log")
|
||||
inspect(sink.file_policy_or_none() is None, content="false")
|
||||
inspect(sink.file_default_policy_or_none() is None, content="false")
|
||||
inspect(sink.file_state_or_none() is None, content="false")
|
||||
@@ -199,7 +199,7 @@ test "runtime sink queued file helpers preserve queue-aware file runtime state"
|
||||
inspect(snapshot.queued, content="true")
|
||||
inspect(snapshot.pending_count, content="2")
|
||||
inspect(snapshot.dropped_count, content="1")
|
||||
inspect(snapshot.file.path, content="runtime-queued-file.log")
|
||||
inspect(snapshot.file.path, content="logs/runtime-queued-file.log")
|
||||
}
|
||||
None => inspect(false, content="true")
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ test "runtime sink progress helpers expose queue and plain file steps separately
|
||||
inspect(queued_progress.file_backed, content="false")
|
||||
|
||||
let file_sink = RuntimeSink::File(
|
||||
file_sink("runtime-progress-direct.log", auto_flush=false),
|
||||
file_sink("logs/runtime-progress-direct.log", auto_flush=false),
|
||||
)
|
||||
let file_progress = file_sink.flush_progress()
|
||||
inspect(file_progress.queue_advanced_count, content="0")
|
||||
|
||||
Reference in New Issue
Block a user