v0.1.3-pre.005-fix-001

This commit is contained in:
2026-08-15 20:26:24 +02:00
parent 063b24ee1c
commit 3a479e4f43
3 changed files with 127 additions and 7 deletions

View File

@@ -1,10 +1,11 @@
// file: crates/ksp-logging-lib/tests/runtime.rs
// version: 6
// version: 7
//! Integration tests for global initialization, takeover filtering, non-blocking outputs and hot reload.
const LOGGING_TARGET: &str = "ksp-logging-lib";
const OTHER_KSP_TARGET: &str = "ksp-store-lib";
const JSON_KSP_TARGET: &str = "ksp-logging-json-test";
const EXTERNAL_TARGET: &str = "sqlx";
fn logging_trace_enabled() -> bool {
@@ -230,7 +231,7 @@ fn global_runtime_supports_takeover_non_blocking_outputs_hot_reload_and_single_i
"runtime.jsonl",
ksp_logging_lib::FileRotation::Never,
ksp_logging_lib::LogFormat::Json,
ksp_logging_lib::OutputFilter::new(ksp_logging_lib::LogFilterLevel::Trace, std::vec![LOGGING_TARGET.to_string()], std::vec!["*".to_string()],),
ksp_logging_lib::OutputFilter::new(ksp_logging_lib::LogFilterLevel::Trace, std::vec![JSON_KSP_TARGET.to_string()], std::vec!["*".to_string()],),
),
],
);
@@ -238,6 +239,8 @@ fn global_runtime_supports_takeover_non_blocking_outputs_hot_reload_and_single_i
assert!(file_reload.is_ok());
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");
ksp_logging_lib::error!(target: JSON_KSP_TARGET, "json error marker");
ksp_logging_lib::warn!(target: OTHER_KSP_TARGET, "store warning marker");
ksp_logging_lib::info!(target: OTHER_KSP_TARGET, "store info must be filtered");
tracing::error!(target: EXTERNAL_TARGET, "external marker must remain silent");
@@ -256,9 +259,9 @@ fn global_runtime_supports_takeover_non_blocking_outputs_hot_reload_and_single_i
assert!(!compact_text.contains("logging info marker"));
assert!(pretty_text.contains("logging error marker"));
assert!(!pretty_text.contains("logging info marker"));
assert!(json_text.contains("logging info marker"));
assert!(json_text.contains("logging error marker"));
assert!(json_text.contains(LOGGING_TARGET));
assert!(json_text.contains("json info marker"));
assert!(json_text.contains("json error marker"));
assert!(json_text.contains(JSON_KSP_TARGET));
assert!(!json_text.contains("store warning marker"));
assert!(!human_text.contains("external marker must remain silent"));
assert!(!compact_text.contains("external marker must remain silent"));