Add more logging during plugin loading

This commit is contained in:
Oliver Hamlet
2026-04-03 17:12:59 +01:00
parent 991e87b9ad
commit 665b18e394
2 changed files with 12 additions and 8 deletions
+10 -6
View File
@@ -686,17 +686,21 @@ fn try_load_plugin(
) -> Option<Plugin> {
let resolved_path = resolve_plugin_path(game_type, data_path, plugin_path);
match Plugin::new(game_type, game_cache, &resolved_path, load_scope) {
Ok(p) => Some(p),
Err(e) => {
Plugin::new(game_type, game_cache, &resolved_path, load_scope)
.inspect(|_| {
logging::debug!(
"Successfully loaded the plugin at \"{}\"",
escape_ascii(plugin_path)
);
})
.inspect_err(|e| {
logging::error!(
"Caught error while trying to load \"{}\": {}",
escape_ascii(plugin_path),
format_details(&e)
);
None
}
}
})
.ok()
}
fn resolve_plugin_path(game_type: GameType, data_path: &Path, plugin_path: &Path) -> PathBuf {
+2 -2
View File
@@ -291,7 +291,7 @@ pub(crate) fn validate_plugin_path_and_header(
Ok(())
} else if !has_plugin_file_extension(game_type, plugin_path) {
logging::debug!(
"The file \"{}\" is not a valid plugin",
"The file \"{}\" is not a valid plugin, as it has an unsupported file extension",
escape_ascii(plugin_path)
);
Err(PluginValidationError::invalid(
@@ -303,7 +303,7 @@ pub(crate) fn validate_plugin_path_and_header(
Ok(())
} else {
logging::debug!(
"The file \"{}\" is not a valid plugin",
"The file \"{}\" is not a valid plugin, as it has an invalid header",
escape_ascii(plugin_path)
);
Err(PluginValidationError::new(