mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Add more logging during plugin loading
This commit is contained in:
+10
-6
@@ -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
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user