Llama Logger is a centralized error logging service designed to help developers track and manage exceptions across all their projects. By consolidating error logs into a single platform, it eliminates the need to manually access server log files, streamlining the debugging process.
In order to utilize this module, you must have a Llama Logger account set up. If you don't have Llama Logger, create a free account at www.llamalogger.com
Llama Logger is a centralized error logging service designed to help developers track and manage exceptions across all their projects. By consolidating error logs into a single platform, it eliminates the need to manually access server log files, streamlining the debugging process.
In order to utilize this module, you must have a Llama Logger account set up. If you don't have Llama Logger, create a free account at www.llamalogger.com
Install-Package 'Llamachant.ExpressApp.LlamaLogger'
In your program.cs file, use LlamaLoggerTracing.Setup and LlamaLoggerTracing.Initialize along with your project API key and application version number to set up error logging.
Example:
public static int Main(string[] args) {
string version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
LlamaLoggerTracing.Setup("{your_api_key}", version);
LlamaLoggerTracing.Initialize();
}
Install-Package 'Llamachant.ExpressApp.LlamaLogger'
In your program.cs file, use LlamaLoggerTracing.Setup and LlamaLoggerTracing.Initialize along with your project API key and application version number to set up error logging.
Example:
public static int Main(string[] args) {
string version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
LlamaLoggerTracing.Setup("{your_api_key}", version);
LlamaLoggerTracing.Initialize();
}
It’s often helpful to have more context around an exception when it occurs. Llama Logger allows you to include custom data (text) to your exceptions (Standard subscription or higher required). You can add custom data globally and/or per-exception.
Each custom data value can be a maximum of 512 characters including spaces.
Custom data added globally will be included with every exception. Typically, this includes environmental data such as server and other values that don't change.
LlamaLoggerClient client = new LlamaLoggerClient(apikey, version);
client.AddCustomData("Server", "Server001"); //This data will be included with every exception
Custom data added per-exception helps to provide context about the specific error. Typically, this includes session specific data such as the current user of your system.
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 exception only
e.LogEntry.AddCustomData("IP Address", "10.0.0.1"); //This data will be included with this exception only
}
It’s often helpful to have more context around an exception when it occurs. Llama Logger allows you to include custom data (text) to your exceptions (Standard subscription or higher required). You can add custom data globally and/or per-exception.
Each custom data value can be a maximum of 512 characters including spaces.
Custom data added globally will be included with every exception. Typically, this includes environmental data such as server and other values that don't change.
LlamaLoggerClient client = new LlamaLoggerClient(apikey, version);
client.AddCustomData("Server", "Server001"); //This data will be included with every exception
Custom data added per-exception helps to provide context about the specific error. Typically, this includes session specific data such as the current user of your system.
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 exception only
e.LogEntry.AddCustomData("IP Address", "10.0.0.1"); //This data will be included with this exception only
}
Llama Logger allows you to include attachments with your exceptions (Standard subscription or higher required). Attachments can be added per-exception and should be kept small as they count towards your monthly data transfer limit.
Attachments provide additional context. Typically, this includes session specific data such as an audit log or a screenshot.
LlamaLoggerClient client = new LlamaLoggerClient(apikey, version);
client.CustomizeLogEntry += Client_CustomizeLogEntry;
void Client_CustomizeLogEntry(object? sender, LlamaLogger.Core.CustomEventArgs.CustomizeLogEntryEventArgs e)
{
byte[] screenshot = GetScreenshotData(); //Get an array of data from your choosing
e.LogEntry.AddAttachment("Screenshot.png", screenshot);
}
byte[] GetScreenshotData() {}
Llama Logger allows you to include attachments with your exceptions (Standard subscription or higher required). Attachments can be added per-exception and should be kept small as they count towards your monthly data transfer limit.
Attachments provide additional context. Typically, this includes session specific data such as an audit log or a screenshot.
LlamaLoggerClient client = new LlamaLoggerClient(apikey, version);
client.CustomizeLogEntry += Client_CustomizeLogEntry;
void Client_CustomizeLogEntry(object? sender, LlamaLogger.Core.CustomEventArgs.CustomizeLogEntryEventArgs e)
{
byte[] screenshot = GetScreenshotData(); //Get an array of data from your choosing
e.LogEntry.AddAttachment("Screenshot.png", screenshot);
}
byte[] GetScreenshotData() {}
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****");
}
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****");
}
For documentation on more advanced features, subscription details, and to see a walkthrough of the UI features and Organization/Project setup, please visit the Llama Logger site Here.
For documentation on more advanced features, subscription details, and to see a walkthrough of the UI features and Organization/Project setup, please visit the Llama Logger site Here.