public void Dispose() { // 1. it's important to dispose _logger before log objects // because _logger.Dispose() calls Flush() on its log objects // 2. it's important to dispose _csvFileLogger before _kustoUploader because // csvFileLogger.Dispose() can post one last file to be uploaded to Kusto // 3. it's important to dispose _kustoUploader before _consoleLog because // _kustoUploader uses _consoleLog _logger.Dispose(); _fileLog?.Dispose(); _csvFileLog?.Dispose(); _kustoUploader?.Dispose(); _consoleLog.Dispose(); _fileSystem.Dispose(); }
protected virtual void Dispose(bool disposing) { if (!_disposedValue) { if (disposing) { _scheduler?.Dispose(); _schedulerLogWriter?.Dispose(); _alertNotifier?.Dispose(); _kustoIngestClient?.Dispose(); _cslQueryProvider?.Dispose(); _logger?.Dispose(); _csvFileLog?.Dispose(); _consoleLog?.Dispose(); } _disposedValue = true; } }