.NET SDK
Error tracking for .NET applications with ASP.NET Core middleware support.
.NET 6.0+
ASP.NET Core
Installation
dotnet add package Alertiqo.Client
ASP.NET Core Setup
Add to your Program.cs:
using Alertiqo.Client;
using Alertiqo.Client.Middleware;
var builder = WebApplication.CreateBuilder(args);
// Add Alertiqo services
builder.Services.AddAlertiqo(options =>
{
options.ApiKey = builder.Configuration["Alertiqo:ApiKey"]!;
options.Endpoint = builder.Configuration["Alertiqo:Endpoint"] ?? "https://alertiqo.io";
options.Environment = builder.Environment.EnvironmentName;
});
var app = builder.Build();
// Add Alertiqo middleware (should be early in the pipeline)
app.UseAlertiqo();
app.Run();
Configuration
Add to your appsettings.json:
{
"Alertiqo": {
"ApiKey": "your-api-key",
"Endpoint": "https://alertiqo.io"
}
}
Console/Desktop Apps
For non-web applications, use the static helper:
using Alertiqo.Client;
// Initialize once at startup
Alertiqo.Init("your-api-key", "https://alertiqo.io");
try
{
// Your code here
}
catch (Exception ex)
{
Alertiqo.CaptureException(ex);
throw;
}
Capture Exceptions
try
{
// Your code
}
catch (Exception ex)
{
await alertiqo.CaptureExceptionAsync(ex);
}
Capture Messages
await alertiqo.CaptureMessageAsync("Something went wrong", "error");
await alertiqo.CaptureMessageAsync("This is a warning", "warning");
User Context
Alertiqo.SetUser("user-123", "[email protected]", "John Doe");
Tags
Alertiqo.SetTag("feature", "checkout");
Alertiqo.SetTag("tenant", "acme-corp");
Breadcrumbs
Alertiqo.AddBreadcrumb("User clicked checkout button", "ui", "user");
Alertiqo.AddBreadcrumb("API call to /api/orders", "http", "info");
Alertiqo.AddBreadcrumb("Order created successfully", "app", "info", new Dictionary<string, object>
{
{ "order_id", 12345 }
});
Configuration Options
| Option | Description | Default |
|---|---|---|
| ApiKey | Your Alertiqo API key | Required |
| Endpoint | Alertiqo API endpoint | https://alertiqo.io |
| Environment | Environment name | production |
| AppVersion | Application version | null |
| IncludeRequestData | Include HTTP request data | true |
| IncludeUserData | Include user data | true |
| MaxBreadcrumbs | Maximum breadcrumbs to keep | 50 |
| TimeoutSeconds | HTTP request timeout | 30 |
Dependency Injection
public class MyService
{
private readonly IAlertiqoClient _alertiqo;
public MyService(IAlertiqoClient alertiqo)
{
_alertiqo = alertiqo;
}
public async Task DoSomethingAsync()
{
try
{
// Your code
}
catch (Exception ex)
{
await _alertiqo.CaptureExceptionAsync(ex);
throw;
}
}
}