v0.1.4-pre.016

This commit is contained in:
2026-08-16 19:00:49 +02:00
parent d92eb01bc2
commit 5aa538ed5d
29 changed files with 994 additions and 73 deletions

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-logging-lib/tests/runtime.rs
// version: 8
// version: 9
//! Integration tests for global initialization, takeover filtering, non-blocking outputs and hot reload.
@@ -119,7 +119,13 @@ fn global_runtime_supports_takeover_non_blocking_outputs_hot_reload_and_single_i
std::option::Option::None,
std::vec::Vec::new(),
);
let initialize_result = ksp_logging_lib::initialize(&disabled);
let identity = ksp_logging_lib::LoggingRuntimeIdentity::new("ksp-logging-runtime-test", "20260816-182519.123Z-p4242");
assert!(identity.is_ok());
let identity = match identity {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => return,
};
let initialize_result = ksp_logging_lib::initialize_with_identity(&disabled, &identity);
assert!(initialize_result.is_ok());
let mut guard = match initialize_result {
std::result::Result::Ok(guard) => guard,
@@ -222,6 +228,12 @@ fn global_runtime_supports_takeover_non_blocking_outputs_hot_reload_and_single_i
);
let file_reload = ksp_logging_lib::reinitialize(&mut guard, &files_enabled);
assert!(file_reload.is_ok());
assert_eq!(guard.runtime_identity(), std::option::Option::Some(&identity));
let active_files = guard.active_file_outputs();
assert_eq!(active_files.len(), 4);
for file in &active_files {
assert!(file.file_name_prefix().starts_with("ksp-logging-runtime-test.20260816-182519.123Z-p4242."));
}
ksp_logging_lib::info!(target: LOGGING_TARGET, "logging info \x1b[31mmarker\x1b[0m");
ksp_logging_lib::error!(target: LOGGING_TARGET, "logging error marker");
ksp_logging_lib::info!(target: JSON_KSP_TARGET, "json info marker");