Docs menu · Attachments
DocsLlamaLogger.Core SDK

Attachments

Standard subscription or higherLlamaLogger.Core 26.1.2

Llama Logger lets you attach files to your entries.
Attachments are added per entry and should be kept small, as they count towards your monthly data transfer limit.

Attachments

Adding Attachments

Attachments provide additional context. Typically, this includes session-specific data such as an audit log or a screenshot. Add them in the CustomizeLogEntry event, which runs for every entry before it's sent (see Customize Entries). There is no global attachment setting.

LlamaLoggerClient client = new LlamaLoggerClient(apikey, version);
client.CustomizeLogEntry += Client_CustomizeLogEntry;

void Client_CustomizeLogEntry(object? sender, LlamaLogger.Core.CustomEventArgs.CustomizeLogEntryEventArgs e)
{
    if (e.LogEntry.Exception == null)
        return; //Only attach screenshots to exceptions, not text messages

    byte[] screenshot = GetScreenshotData();
    e.LogEntry.AddAttachment("Screenshot.png", screenshot);
}

byte[] GetScreenshotData() => File.ReadAllBytes("screenshot.png"); //Replace with your own capture logic

Each attachment name must be unique within an entry: adding a second attachment with the same name is ignored. You can also use e.LogEntry.GetAttachment(name) and e.LogEntry.RemoveAttachment(name).

How attachments are sent

  1. The entry itself is sent first.
  2. If your plan includes attachments, the files are then uploaded separately. On plans without attachments, the files are never sent.
  3. A failed attachment upload isn't retried, but the entry itself is still recorded.