Before entries are sent, you can customize them using the CustomizeLogEntry event. This is an opportunity to modify information, provide additional context, or cancel the exception upload.
In this example, we will ignore all ValidationExceptions:
LlamaLoggerClient client = new LlamaLoggerClient(apikey, version);
client.AddIgnoredExceptionType<ValidationException>();
In this example, we will ignore an InvalidOperationException where the message contains the word "test":
LlamaLoggerClient client = new LlamaLoggerClient(apikey, version);
client.CustomizeLogEntry += Client_CustomizeLogEntry;
void Client_CustomizeLogEntry(object? sender, LlamaLogger.Core.CustomEventArgs.CustomizeLogEntryEventArgs e)
{
if (e.LogEntry.Exception is InvalidOperationException ex && ex.Message.Contains("test"))
e.Cancel = true; //This prevents the exception from being sent to Llama Logger
}
In this example, we are removing the occurrence of a particular password:
LlamaLoggerClient client = new LlamaLoggerClient(apikey, version);
client.CustomizeLogEntry += Client_CustomizeLogEntry;
void Client_CustomizeLogEntry(object? sender, LlamaLogger.Core.CustomEventArgs.CustomizeLogEntryEventArgs e)
{
if (Convert.ToBoolean(e.LogEntry.ExceptionString?.Contains("Pa$$word")))
e.LogEntry.ExceptionString = e.LogEntry.ExceptionString.Replace("Pa$$word", "***REMOVED****");
}