public MLogLoggerProvider(IOptions <MLogLoggerOptions> options) { _options = options.Value; if (string.IsNullOrEmpty(_options.Url?.AbsoluteUri) || _options.Certificate == null) { throw new ArgumentException("MLog Url or Certificate are missing.", nameof(options)); } _mlogClient = new MLogClient(_options.Url, _options.Certificate, false); _messageProcessor = new MLogMessageProcessor(_mlogClient, _options.ErrorLogger); }
public MLogMessageProcessor(MLogClient mlogClient, ILogger errorLogger) { _mlogClient = mlogClient; _errorLogger = errorLogger; _messageQueue = new BlockingCollection <string>(_maxQueuedMessages); _processorThread = new Thread(StartAsync) { IsBackground = true, Name = "MLog logger queue processing thread" }; _processorThread.Start(); }