Docs menu · Custom Data
DocsLlamaLogger.Core SDK

Custom Data

Standard subscription or higherLlamaLogger.Core 26.1.2

It’s often helpful to have more context around an exception when it occurs. Llama Logger lets you include custom data (name and value text pairs) with your entries. You can add custom data globally, per entry, or both.
Each custom data value can be a maximum of 512 characters including spaces. Longer values are truncated.

Custom Data

On plans without custom data, values you add are ignored; no error is raised.

Adding Custom Data Globally

Custom data added globally is included with every entry the client sends, including text messages. Typically, this includes environmental data such as the server name and other values that don't change.

LlamaLoggerClient client = new LlamaLoggerClient(apikey, version);
client.AddCustomData("Server", "Server001"); //This data will be included with every entry

Adding a name that already exists replaces its value, and client.RemoveCustomData("Server") removes it. Global values are copied onto each entry when it's created, so changing them later doesn't affect entries that are already queued.

Adding Custom Data Per-Entry

Custom data added per entry provides context about the specific error. Typically, this includes session-specific data such as the current user of your system. Add it in the CustomizeLogEntry event, which runs for every entry before it's sent (see Customize Entries):

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

void Client_CustomizeLogEntry(object? sender, LlamaLogger.Core.CustomEventArgs.CustomizeLogEntryEventArgs e)
{
    e.LogEntry.AddCustomData("UserName", "Admin"); //This data will be included with this entry only
    e.LogEntry.AddCustomData("IP Address", "10.0.0.1"); //This data will be included with this entry only
}

In the event you can also read values with e.LogEntry.GetCustomData(name) and remove them with e.LogEntry.RemoveCustomData(name), including global values that were copied onto the entry.

Using Custom Data in Llama Logger

Custom data appears on each entry's Custom Data tab. In the Log Entries grid you can also:

  • Show up to five custom data values as columns with Custom Data Columns.
  • Find every error a particular user or server hit with Custom Data Filter, for example UserName = jsmith.
  • Include custom data in notification emails with the project's Include Custom Data In Emails option.

See Getting Started with the app and Project Setup. Text Search and the MCP server's search_logs tool also search custom data.