Pbg.Logging
1.0.32
dotnet add package Pbg.Logging --version 1.0.32
NuGet\Install-Package Pbg.Logging -Version 1.0.32
<PackageReference Include="Pbg.Logging" Version="1.0.32" />
<PackageVersion Include="Pbg.Logging" Version="1.0.32" />
<PackageReference Include="Pbg.Logging" />
paket add Pbg.Logging --version 1.0.32
#r "nuget: Pbg.Logging, 1.0.32"
#:package Pbg.Logging@1.0.32
#addin nuget:?package=Pbg.Logging&version=1.0.32
#tool nuget:?package=Pbg.Logging&version=1.0.32
Pbg.Logging
A high-performance, centralized logging library for .NET applications that captures and sends structured logs to a remote endpoint in batches.
✨ Features
- 🚀 Asynchronous & non-blocking
- 📦 Batch processing with configurable intervals
- 🔄 Automatic retry with exponential backoff
- 🌐 HTTP request/response middleware
- 🔍 Distributed tracing support
- 🎯 Smart log filtering
📦 Installation
Install via NuGet Package Manager:
dotnet add package Pbg.Logging
Or via NuGet Package Manager Console:
Install-Package Pbg.Logging
Or visit the NuGet Gallery
🌐 Log Dashboard
Visit https://logs.pbg.ge/ to:
- 📋 View and search logs — browse all captured logs from your applications in real time
- 🔑 Generate a Service-Key — after registration, create a
LicenseKeyto use with this library
Getting started: Register at logs.pbg.ge, generate your Service-Key, and use it as the
LicenseKeyin your configuration.
Quick Start
ASP.NET Core Web API
using Pbg.Logging;
var builder = WebApplication.CreateBuilder(args);
builder.Logging.AddPbgLogger(options =>
{
options.LicenseKey = new Guid("your-license-key-here");
options.EndpointUrl = "https://logs.pbg.ge/api/v1/log";
options.ProjectName = "MyWebApi";
options.Environment = PbgEnvironment.Production;
});
var app = builder.Build();
app.UsePbgLogging(); // Automatic HTTP logging middleware
app.Run();
Console Application
using Pbg.Logging;
var host = Host.CreateDefaultBuilder(args)
.ConfigureServices((context, services) =>
{
services.AddLogging(builder =>
{
builder.AddPbgLogger(options =>
{
options.LicenseKey = new Guid("your-license-key-here");
options.EndpointUrl = "https://your-endpoint.com/api/logs";
options.ProjectName = "MyConsoleApp";
options.Environment = PbgEnvironment.Development;
});
});
})
.Build();
await host.RunAsync();
Usage
public class MyService
{
private readonly ILogger<MyService> _logger;
public MyService(ILogger<MyService> logger)
{
_logger = logger;
}
public void DoWork()
{
_logger.LogInformation("Processing started");
_logger.LogError("Something went wrong");
}
}
Environment Mapping (One Code for All Environments)
Use ASPNETCORE_ENVIRONMENT/builder.Environment.EnvironmentName and map it to PbgEnvironment once:
using Pbg.Logging.Model;
builder.Logging.AddPbgLogger(options =>
{
options.LicenseKey = Guid.Parse(builder.Configuration["PbgLogging:LicenseKey"]!);
options.EndpointUrl = builder.Configuration["PbgLogging:EndpointUrl"]!;
options.ProjectName = builder.Configuration["PbgLogging:ProjectName"] ?? builder.Environment.ApplicationName;
options.Environment = builder.Environment.EnvironmentName.ToLowerInvariant() switch
{
"development" => PbgEnvironment.Development,
"staging" => PbgEnvironment.Staging,
"production" => PbgEnvironment.Production,
"testing" => PbgEnvironment.Testing,
"uat" => PbgEnvironment.Uat,
_ => PbgEnvironment.Production
};
});
LicenseKey can be the same for all environments or different per environment (recommended).
Keep values in appsettings.{Environment}.json:
{
"PbgLogging": {
"LicenseKey": "11111111-1111-1111-1111-111111111111",
"EndpointUrl": "https://logs.pbg.ge/api/v1/log",
"ProjectName": "MyService"
}
}
⚙️ Configuration
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
LicenseKey |
Guid |
✅ | - | Your license key |
EndpointUrl |
string |
✅ | - | API endpoint URL |
ProjectName |
string |
"UnknownProject" |
Project identifier | |
Environment |
PbgEnvironment |
✅ | - | Development, Staging, Production, Testing, Uat |
BatchSize |
int |
20 |
Logs per batch | |
FlushInterval |
TimeSpan |
3s |
Batch send interval | |
RequestTimeout |
TimeSpan |
30s |
Timeout for log upload HTTP requests | |
MaxRetries |
int |
3 |
Upload retry attempts before local fallback | |
RetryBaseDelay |
TimeSpan |
2s |
Exponential backoff base delay (2s, 4s, 8s...) | |
ExcludedBodyPathPrefixes |
HashSet<string> |
/health,/healthz,/metrics,/swagger |
Skip request/response body capture for matching path prefixes |
HTTP capture defaults are built-in and always on:
- Request headers
- Response headers
- Request body (when present)
- Response body (when present)
- Outbound
HttpClientinterception forIHttpClientFactoryclients - UserId from claims (when present)
- Body capture limit:
2000characters (JSON responses are logged fully)
📊 Log Structure
{
"timestamp": "2026-01-15T10:30:00Z",
"logLevel": "Information",
"message": "Your log message",
"projectName": "MyApp",
"environment": "Production",
"machineName": "SERVER-01",
"ipAddress": "192.168.1.100",
"traceId": "abc123",
"userId": "user-123",
"method": "POST",
"path": "/api/users",
"statusCode": 200,
"requestBody": "{...}",
"responseBody": "{...}",
"elapsedMilliseconds": 45.2,
"exception": null
}
🎯 Automatic Filtering
- ✅ All
Errorand above - ✅
Microsoft.Hosting.Lifetimelogs - ⚠️ Microsoft/System logs:
Warningand above only - ✅ Application logs: All levels
🔄 Retry Strategy
- Max retries: 3
- Backoff: 2s → 4s → 8s (exponential)
- Timeout: 30s per request (configurable via
RequestTimeout)
Upload Failure Handling
- Retryable failures: network errors,
5xx,408,429 - Retryable batches are saved as
batch_*.jsonand retried later - Non-retryable failures:
4xx(except408and429) - Non-retryable batches are moved to
rejected_*.jsonand skipped - Local files are stored in
%TEMP%/Pbg.Logging/{ProjectName}
📝 License
Requires a valid license key.
🔗 Links
- Dashboard: logs.pbg.ge — View logs & generate Service-Keys
- GitHub: guliv3r/Pbg.Logging
- Issues: Report bugs
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. 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 is compatible. 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 is compatible. 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. |
-
net10.0
- No dependencies.
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.32 | 599 | 3/4/2026 |
| 1.0.31 | 113 | 3/4/2026 |
| 1.0.30 | 116 | 3/4/2026 |
| 1.0.29 | 119 | 3/2/2026 |
| 1.0.28 | 127 | 3/2/2026 |
| 1.0.27 | 121 | 3/2/2026 |
| 1.0.26 | 126 | 3/2/2026 |
| 1.0.25 | 117 | 3/2/2026 |
| 1.0.24 | 117 | 3/2/2026 |
| 1.0.23 | 115 | 2/27/2026 |
| 1.0.22 | 116 | 2/27/2026 |
| 1.0.21 | 122 | 2/27/2026 |
| 1.0.18 | 115 | 2/27/2026 |
| 1.0.17 | 114 | 2/27/2026 |
| 1.0.16 | 115 | 2/20/2026 |
| 1.0.15 | 124 | 2/20/2026 |
| 1.0.13 | 118 | 2/20/2026 |
| 1.0.12 | 115 | 2/16/2026 |
| 1.0.11 | 119 | 2/16/2026 |
| 1.0.2-preview.0.3 | 76 | 2/16/2026 |