Docs menu · Flushing the Queue
DocsLlamaLogger.Core SDK

Flushing the Queue

LlamaLogger.Core 26.1.2

The LlamaLoggerClient sends entries in the background so your application's performance isn't affected. Because of this, your application can exit before all entries have been sent. You can give queued entries a chance to be sent by calling FlushQueue() or disposing of the LlamaLoggerClient.

LlamaLoggerClient client = new LlamaLoggerClient(apikey, version);
...
client.FlushQueue(10000); //Allow up to 10 seconds for the queue to be flushed
LlamaLoggerClient client = new LlamaLoggerClient(apikey, version);
...
client.Dispose(); //Waits up to 20 seconds for the queue to be flushed

Good to know

  • FlushQueue blocks the calling thread until the queue is empty or the time runs out, so avoid calling it on a UI thread.
  • Dispose() flushes for up to 20 seconds when AutoFlush is true (the default). Set client.AutoFlush = false to dispose without waiting.
  • client.IsBusy tells you whether any sink still has entries to send. Custom sinks are included, so a custom sink that always reports busy makes every flush wait for the full timeout.
  • Entries that fail to send are retried up to 5 times, then dropped.