ILogEntryParser TryCreateParser(IPluginWithDescription <ILogEntryParserPlugin> pair, ILogFileFormat format) { try { var parser = pair.Plugin.CreateParser(_services, format); if (parser != null) { return(new NoThrowLogEntryParser(parser)); } return(null); } catch (Exception e) { Log.ErrorFormat("Caught unexpected exception from plugin {0}: {1}", pair?.Description?.Id, e); return(null); } }
ILogSource TryCreateParser(IPluginWithDescription <ILogSourceParserPlugin> pair, ILogSource source) { try { var parser = pair.Plugin.CreateParser(_services, source); if (parser != null) { return(new NoThrowLogSource(parser, pair.Description.Name)); } return(null); } catch (Exception e) { Log.ErrorFormat("Caught unexpected exception from plugin {0}: {1}", pair?.Description?.Id, e); return(null); } }