Exemplo n.º 1
0
        public ILogSource CreateCustom(CustomDataSourceId id, ICustomDataSourceConfiguration configuration,
                                       out IPluginDescription pluginDescription)
        {
            var pair = _dataSourcePlugins.First(x => x.Plugin.Id == id);

            pluginDescription = pair.Description;
            var logFile = TryCreateCustomWith(pair.Plugin, configuration);

            return(new NoThrowLogSource(logFile, pluginDescription.Name));
        }
        public NoThrowCustomDataSourcePlugin(ICustomDataSourcePlugin inner)
        {
            _inner = inner;

            try
            {
                _name = inner.DisplayName;
                _id   = inner.Id;
            }
            catch (Exception e)
            {
                Log.ErrorFormat("Caught unexpected exception: {0}", e);
                _name = inner.GetType().Name;
                _id   = null;
            }
        }
Exemplo n.º 3
0
        public CustomDataSource AddCustom(CustomDataSourceId id)
        {
            CustomDataSource dataSource;

            var plugin = _logSourceFactory.CustomDataSources.First(x => x.Id == id);

            lock (_syncRoot)
            {
                var settings = new DataSource
                {
                    Id                            = DataSourceId.CreateNew(),
                    DisplayName                   = plugin.DisplayName,
                    CustomDataSourceId            = plugin.Id,
                    CustomDataSourceConfiguration = plugin.CreateConfiguration(null)
                };
                _settings.Add(settings);
                dataSource = (CustomDataSource)AddDataSource(settings);
            }

            return(dataSource);
        }
Exemplo n.º 4
0
 public ILogSource CreateCustom(CustomDataSourceId id, ICustomDataSourceConfiguration configuration)
 {
     return(CreateCustom(id, configuration, out _));
 }
Exemplo n.º 5
0
        private void AddCustomDataSource(CustomDataSourceId id)
        {
            var dataSource = _dataSources.AddCustom(id);

            Add(dataSource);
        }