LogCenter.Logger 1.0.2

dotnet add package LogCenter.Logger --version 1.0.2
                    
NuGet\Install-Package LogCenter.Logger -Version 1.0.2
                    
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="LogCenter.Logger" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LogCenter.Logger" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="LogCenter.Logger" />
                    
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 LogCenter.Logger --version 1.0.2
                    
#r "nuget: LogCenter.Logger, 1.0.2"
                    
#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 LogCenter.Logger@1.0.2
                    
#: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=LogCenter.Logger&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=LogCenter.Logger&version=1.0.2
                    
Install as a Cake Tool

LogCenter.Logger

This package helps you send logs from a .NET console application to LogCenter using the standard ILogger abstraction.

See: https://github.com/hudsonventura/LogCenter

Web Interface

Getting Started

Install the package:

dotnet add package Microsoft.Extensions.Logging.Console && \
dotnet add package LogCenter.Logger

Basic Setup

The example below is based on examples/dotnet/Program.cs.

using LogCenter;
using Microsoft.Extensions.Logging;

var drain = new LogCenterDrain();

using var loggerFactory = LoggerFactory.Create(builder =>
{
    builder.ClearProviders();
    builder.AddLogCenter(
        new LogCenterOptions
        {
            // LogCenter's URL
            url = "http://localhost:9200",

            // Table name 
            table = "example_interceptor",

            // Generate this on LogCenter inteface, on you profile photo.
            token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",

            // The timeout to send the log and data to LogCenter
            Timeout = 5000
        },
        drain);
});

var logger = loggerFactory.CreateLogger<Program>();

Logging Messages

After configuring the provider, use ILogger exactly as you normally would in a console application:


var test = new
{
    nome = "John Doe Jr. da Silva",
    idade = 30,
    email = "john.doe.jr@example.com"
};

logger.LogInformation("Dados do usuário {@user}", test);
logger.LogDebug("Hello World - Debug");
logger.LogInformation("Hello World - Information");
logger.LogWarning("Hello World - Warning");
logger.LogError("Hello World - Error");
logger.LogCritical("Hello World - Critical");

Unhandled Exceptions

For console applications, you can log an unhandled exception and wait for the HTTP send to finish before shutdown. The the drain at line var drain = new LogCenterDrain(); and used after, is going to guarantee this functionality.

Structured Logging

LogCenter.Logger supports structured logging with message templates.

Example:

var user = new
{
    nome = "John Doe Jr. da Silva",
    idade = 30,
    email = "john.doe.jr@example.com"
};

logger.LogInformation("User data {@user}", user);

Tags

LogCenter.Logger supports tags. Use:

Example:

var tags = new string[] {"tag 1", "tag 2", "whatever"}
//or
var tags = new List<string> {"tag 1", "tag 2", "whatever"}

//MUST BE "_tags_"
logger.LogInformation("User data {@user} {@_tags_}", user, tags);

This sends:

  • the rendered message
  • the log level
  • timestamp
  • trace information when available
  • structured properties as JSON

That makes the data readable in LogCenter and also searchable as JSON.

Notes

  • The package works with the normal ILogger API.
  • Logs are sent over HTTP to LogCenter.
  • Structured objects are serialized and stored in a JSON-friendly way.
  • This package is a good fit for console apps, workers, background services, and other non-ASP.NET processes.

Build

To build the NuGet package locally:

dotnet pack src/libs/nuget/Logger/Logger.csproj -c Release
Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on LogCenter.Logger:

Package Downloads
LogCenter.RequestLogger

Send the request, response and logs to LogCenter. Handles logging and message exchange efficiently.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.2 153 5/3/2026
1.0.1 110 4/29/2026
1.0.0 120 4/27/2026
0.1.1 296 3/17/2025
0.1.0 224 3/16/2025