Logger.SDK 2.2.1

dotnet add package Logger.SDK --version 2.2.1
                    
NuGet\Install-Package Logger.SDK -Version 2.2.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Logger.SDK" Version="2.2.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Logger.SDK" Version="2.2.1" />
                    
Directory.Packages.props
<PackageReference Include="Logger.SDK" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Logger.SDK --version 2.2.1
                    
#r "nuget: Logger.SDK, 2.2.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Logger.SDK@2.2.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Logger.SDK&version=2.2.1
                    
Install as a Cake Addin
#tool nuget:?package=Logger.SDK&version=2.2.1
                    
Install as a Cake Tool

Logger.SDK

Production-grade .NET SDK for centralized exception logging with async queueing, batching, retries, and enriched observability context.

Installation

dotnet add package Logger.SDK

Quick Start

using Logger;

LoggerSdk.Configure(options =>
{
    options.Endpoint = "https://your-api/api/Logs/ReceiveLog";
    options.ApiKey = "lg_xxx";
    options.ProjectId = "00000000-0000-0000-0000-000000000000";
    options.ApplicationName = "Orders.API";
});

// 1. Asynchronous Execution Context
public async Task ProcessOrderAsync()
{
    try 
    {
        await ExecuteLogicAsync();
    }
    catch (Exception ex)
    {
        await LoggerSdk.LogExceptionAsync(ex);
        throw;
    }
}

// 2. Synchronous Execution Context (No async/await)
public void ProcessOrder()
{
    try 
    {
        ExecuteLogic();
    }
    catch (Exception ex)
    {
        LoggerSdk.LogException(ex);
        throw;
    }
}

SaaS Features

  • Non-blocking async logging with bounded queue.
  • Batch flushing with configurable interval.
  • Retry policy for transient failures.
  • Safe process-exit flush to reduce data loss.
  • Exception fingerprinting and duplicate collapse.
  • Trace correlation fields (TraceId, SpanId, CorrelationId).
  • Optional environment/runtime metadata capture.

Configuration

LoggerOptions supports a wide range of settings for performance and observability:

  • Core: Endpoint, ApiKey, ProjectId, ApplicationName
  • Performance: EnableAsyncLogging, MaxQueueSize, MaxBatchSize, FlushIntervalSeconds, RequestTimeoutSeconds, RetryCount, DropOldestWhenQueueFull
  • Context: CaptureEnvironmentInfo, CaptureSourceCode, EnableFingerprinting, CorrelationHeaderName, Tags

ASP.NET Core Registration

// In Program.cs
builder.Services.AddLoggerSdk(builder.Configuration);

var app = builder.Build();

// Optional: Ensure all logs are flushed on graceful shutdown
app.Lifetime.ApplicationStopping.Register(() =>
{
    LoggerSdk.FlushAsync().GetAwaiter().GetResult();
    LoggerSdk.ShutdownAsync().GetAwaiter().GetResult();
});

app.Run();

Complex appsettings.json example:

{
  "Logger": {
    "Endpoint": "https://loggeraiagent-b4b3defjcyh2axds.centralindia-01.azurewebsites.net/api/Logs/ReceiveLog",
    "ApiKey": "lg_your_api_key_here",
    "ProjectId": "your-project-id-here",
    "ApplicationName": "YourApplicationName",
    "EnableAsyncLogging": false,
    "RequestTimeoutSeconds": 5,
    "RetryCount": 1,
    "EnableDebugConsole": true,
    "CaptureSourceCode": false
  }
}

Lifecycle Management

For non-web applications or manual control:

// Graceful shutdown
await LoggerSdk.FlushAsync();
await LoggerSdk.ShutdownAsync();
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.