/// <summary> /// Very important that Dispose() should be called before the program concludes, or else events/telemetry may not be persisted to remote storage! /// </summary> public void Dispose() { _fileLogger.Dispose(); _telemetry.Flush(); Console.Out.WriteLine("Flushing AzureMonitor"); System.Threading.Thread.Sleep(5000); // Allow some time to flush before shutdown. It might not flush right away. (https://docs.microsoft.com/en-us/azure/azure-monitor/app/api-custom-events-metrics#tracktrace) }
public void Dispose() { _parseClient.FlushBatchableOperations(); _logger.Dispose(); }