internal SyslogLogger(string name, string hostName, Func <string, LogLevel, bool> filter, SyslogLoggerProcessor loggerProcessor) { Name = name ?? throw new ArgumentNullException(nameof(name)); HostName = hostName; _filter = filter ?? ((category, logLevel) => true); MessageProcessor = loggerProcessor; }
private void ReloadLoggerOptions(SyslogLoggerProviderOptions providerOptions) { _filter = providerOptions.Filter; // all new loogers will use this instance _messageProcessor = new SyslogLoggerProcessor(providerOptions.SyslogServerHost, providerOptions.SyslogServerPort); // update all existing loggers to use new processor foreach (var logger in _loggers.Values) { // dispose previous logger.MessageProcessor.Dispose(); // set new logger.MessageProcessor = _messageProcessor; logger.Filter = providerOptions.Filter; } }