Cloud based exception logging through www.llamalogger.com
$ dotnet add package LlamaLogger.CoreUsing only a few lines of code, you can start tracking and managing your exceptions online. All of your exceptions will be accessible in one place with the option to receive email notifications when new exceptions arrive.
Go to www.llamalogger.com to get started.
using LlamaLogger.Core;
string apikey = "<project API key>"; //Your project API key from your Llama Logger account
string version = "1.0"; //Your application's version number
LlamaLoggerClient logger = new LlamaLoggerClient(apikey, version);
try
{
throw new InvalidOperationException("Oops!");
}
catch(Exception ex)
{
logger.LogError(ex);
}
logger.FlushQueue(10000);
//Before you exit your application, flush the queue (in this case, up to 10 seconds)
You can customize log entries before they are sent to the server by adding custom data and attachments.
Global Customization
LlamaLoggerClient client = new LlamaLoggerClient(apikey, version);
client.AddCustomData("Server", "Server001"); //This data will be included with every exception
Exception Specific Customization
LlamaLoggerClient client = new LlamaLoggerClient(apikey, version);
client.CustomizeLogEntry += Client_CustomizeLogEntry;
void Client_CustomizeLogEntry(object? sender,
LlamaLogger.Core.CustomEventArgs.CustomizeLogEntryEventArgs e)
{
e.LogEntry.AddCustomData("UserName", "Administrator");
e.LogEntry.AddCustomData("IP Address", "99.88.77.66");
byte[] screenshot = GetScreenshotData(); //Get an array of data
e.LogEntry.AddAttachment("Screenshot.png", screenshot);
}