refactor: improve logging
Release / check-release (push) Successful in 15s
Release / build_gnu (push) Skipped
Release / build_musl (push) Skipped
Release / build_windows (push) Skipped
Release / package_gnu (deb) (push) Skipped
Release / package_gnu (rpm) (push) Skipped
Release / package_musl (deb) (push) Skipped
Release / package_musl (rpm) (push) Skipped
Release / publish-release (push) Skipped
CI / Test (push) Successful in 1m43s
CI / Build Linux (push) Successful in 1m56s
Release / check-release (push) Successful in 15s
Release / build_gnu (push) Skipped
Release / build_musl (push) Skipped
Release / build_windows (push) Skipped
Release / package_gnu (deb) (push) Skipped
Release / package_gnu (rpm) (push) Skipped
Release / package_musl (deb) (push) Skipped
Release / package_musl (rpm) (push) Skipped
Release / publish-release (push) Skipped
CI / Test (push) Successful in 1m43s
CI / Build Linux (push) Successful in 1m56s
This commit is contained in:
1 parent
d3b7d7a18f
commit
b65d5eb97c
8 files changed
+198
-44
No files matched your search
+19
-3
@@ -40,6 +40,7 @@ impl<'a> PathNode<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(plugins))]
|
||||
pub fn find_best_path<'a>(
|
||||
plugins: &'a [Box<dyn Plugin>],
|
||||
from_format: &'a str,
|
||||
@@ -49,7 +50,12 @@ pub fn find_best_path<'a>(
|
||||
) -> Option<Vec<(&'a dyn Plugin, &'a str, &'a str)>> {
|
||||
let mut adj_list: HashMap<&str, Vec<&'a dyn Plugin>> = HashMap::new();
|
||||
for p in plugins {
|
||||
if banned_plugins.contains(&p.name()) || !p.is_available() {
|
||||
if banned_plugins.contains(&p.name()) {
|
||||
tracing::trace!("Skipping banned plugin: {}", p.name());
|
||||
continue;
|
||||
}
|
||||
if !p.is_available() {
|
||||
tracing::trace!("Skipping unavailable plugin: {}", p.name());
|
||||
continue;
|
||||
}
|
||||
for &from in &p.from_formats() {
|
||||
@@ -69,9 +75,11 @@ pub fn find_best_path<'a>(
|
||||
|
||||
while let Some((curr_format, prev_node)) = queue.pop_front() {
|
||||
let current_depth = visited_depth.get(curr_format).copied().unwrap_or(0);
|
||||
tracing::trace!("Visiting format node: {} at depth {}", curr_format, current_depth);
|
||||
|
||||
if let Some(min_len) = min_length {
|
||||
if current_depth > min_len {
|
||||
tracing::trace!("Pruning path exploration at depth {} (min_len={})", current_depth, min_len);
|
||||
break; // We've moved beyond the shortest paths
|
||||
}
|
||||
}
|
||||
@@ -114,13 +122,21 @@ pub fn find_best_path<'a>(
|
||||
}
|
||||
|
||||
if best_paths.is_empty() {
|
||||
tracing::debug!("No valid paths found from {} to {}.", from_format, to_format);
|
||||
return None;
|
||||
}
|
||||
|
||||
tracing::debug!("Found {} path(s) of minimum length {}. Evaluating priority: '{}'", best_paths.len(), min_length.unwrap_or(0), priority);
|
||||
|
||||
// Evaluate based on priority (maximize score)
|
||||
best_paths
|
||||
let best = best_paths
|
||||
.into_iter()
|
||||
.max_by(|path_a, path_b| compare_paths(path_a, path_b, priority))
|
||||
.max_by(|path_a, path_b| compare_paths(path_a, path_b, priority));
|
||||
|
||||
if let Some(ref path) = best {
|
||||
tracing::debug!("Selected path with length {}: {:?}", path.len(), path.iter().map(|p| p.0.name()).collect::<Vec<_>>());
|
||||
}
|
||||
best
|
||||
}
|
||||
|
||||
fn compare_paths(
|
||||
|
||||
Reference in new issue
Block a user