Debug output for plugin loading

This commit is contained in:
Brant Martin
2018-06-14 11:08:09 -04:00
parent 4db83e6f65
commit 8989ae94a7

View File

@@ -377,6 +377,7 @@ namespace Torch.Managers
private void InstantiatePlugin(PluginManifest manifest, IEnumerable<Assembly> assemblies) private void InstantiatePlugin(PluginManifest manifest, IEnumerable<Assembly> assemblies)
{ {
Type pluginType = null; Type pluginType = null;
bool mult = false;
foreach (var asm in assemblies) foreach (var asm in assemblies)
{ {
foreach (var type in asm.GetExportedTypes()) foreach (var type in asm.GetExportedTypes())
@@ -384,16 +385,26 @@ namespace Torch.Managers
if (!type.GetInterfaces().Contains(typeof(ITorchPlugin))) if (!type.GetInterfaces().Contains(typeof(ITorchPlugin)))
continue; continue;
_log.Info($"Loading plugin at {type.FullName}");
if (pluginType != null) if (pluginType != null)
{ {
_log.Error($"The plugin '{manifest.Name}' has multiple implementations of {nameof(ITorchPlugin)}, not loading."); //_log.Error($"The plugin '{manifest.Name}' has multiple implementations of {nameof(ITorchPlugin)}, not loading.");
return; //return;
mult = true;
continue;
} }
pluginType = type; pluginType = type;
} }
} }
if (mult)
{
_log.Error($"The plugin '{manifest.Name}' has multiple implementations of {nameof(ITorchPlugin)}, not loading.");
return;
}
if (pluginType == null) if (pluginType == null)
{ {
_log.Error($"The plugin '{manifest.Name}' does not have an implementation of {nameof(ITorchPlugin)}, not loading."); _log.Error($"The plugin '{manifest.Name}' does not have an implementation of {nameof(ITorchPlugin)}, not loading.");