v0.1.3-pre.005

This commit is contained in:
2026-08-15 20:22:02 +02:00
parent 29660fd9f0
commit 063b24ee1c
17 changed files with 957 additions and 244 deletions

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-logging-lib/src/settings.rs
// version: 3
// version: 4
/// Runtime filter level used by KSP logging settings.
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
@@ -109,19 +109,6 @@ impl OutputFilter {
pub fn domains(&self) -> &[std::string::String] {
return self.domains.as_slice();
}
/// Returns whether this filter leaves routing entirely to the global takeover policy.
pub(crate) fn is_unrestricted(&self) -> bool {
let targets_all = match self.targets.as_slice() {
[selector] => selector == "*",
_ => false,
};
let domains_all = match self.domains.as_slice() {
[selector] => selector == "*",
_ => false,
};
return self.level == crate::LogFilterLevel::Trace && targets_all && domains_all;
}
}
/// Console stream selected for human-readable logs.
@@ -376,6 +363,12 @@ impl LoggingSettings {
}
}
if let std::option::Option::Some(console) = self.console.as_ref() {
if console.ansi() && console.format() == crate::LogFormat::Json {
return std::result::Result::Err(
ksp_core_lib::Error::new(crate::ERROR_CODE_INVALID_SETTINGS, "ANSI formatting is not compatible with JSON console output")
.with_context("field", "console.ansi"),
);
}
let validation_result = validate_output_filter(console.filter(), "console.filter");
if let std::result::Result::Err(error) = validation_result {
return std::result::Result::Err(error);