CSharpEssentials.LoggerHelper.Sink.Console 5.2.2

dotnet add package CSharpEssentials.LoggerHelper.Sink.Console --version 5.2.2
 
NuGet\Install-Package CSharpEssentials.LoggerHelper.Sink.Console -Version 5.2.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="CSharpEssentials.LoggerHelper.Sink.Console" Version="5.2.2" />
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CSharpEssentials.LoggerHelper.Sink.Console" Version="5.2.2" />
 
Directory.Packages.props
<PackageReference Include="CSharpEssentials.LoggerHelper.Sink.Console" />
 
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 CSharpEssentials.LoggerHelper.Sink.Console --version 5.2.2
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: CSharpEssentials.LoggerHelper.Sink.Console, 5.2.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 CSharpEssentials.LoggerHelper.Sink.Console@5.2.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=CSharpEssentials.LoggerHelper.Sink.Console&version=5.2.2
 
Install as a Cake Addin
#tool nuget:?package=CSharpEssentials.LoggerHelper.Sink.Console&version=5.2.2
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

CSharpEssentials.LoggerHelper.Sink.Console

Colored console output with per-level color coding for CSharpEssentials.LoggerHelper.

Targets: net8.0 · net9.0 · net10.0 — Part of the CSharpEssentials.LoggerHelper ecosystem. Install only the sinks you need.


Install

dotnet add package CSharpEssentials.LoggerHelper
dotnet add package CSharpEssentials.LoggerHelper.Sink.Console

Quick Setup — JSON

Add to appsettings.json:

{
 "LoggerHelper": {
 "ApplicationName": "MyApp",
 "Routes": [
 { "Sink": "Console", "Levels": ["Debug", "Information", "Warning", "Error", "Fatal"] }
 ],
 "Sinks": {
 "Console": {
 "OutputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] {Message}{NewLine}{Exception}"
 }
 }
 }
}
// Program.cs
builder.Services.AddLoggerHelper(builder.Configuration);
var app = builder.Build();
app.UseLoggerHelper(); // ← required: activates sinks and registers middleware

Sinks.Console is optional. If omitted, the default template [HH:mm:ss Level] Message is used.


Quick Setup — Fluent API

builder.Services.AddLoggerHelper(b => b
 .WithApplicationName("MyApp")
 .AddRoute("Console", LogEventLevel.Debug, LogEventLevel.Information, LogEventLevel.Warning, LogEventLevel.Error, LogEventLevel.Fatal)
 .ConfigureConsole(c => c.OutputTemplate = "[{Timestamp:HH:mm:ss} {Level:u3}] {Message}{NewLine}{Exception}")
);
var app = builder.Build();
app.UseLoggerHelper(); // ← required

What You'll See

Each line is printed in color according to the log level:

[14:23:01 INF] Application started
[14:23:02 WRN] Retry attempt 1 for endpoint /api/orders
[14:23:03 ERR] Unhandled exception: Connection refused

Default template (no OutputTemplate configured):

[14:23:01 Information] Application started

Configuration Options

Property Type Default Description
OutputTemplate string? null Serilog output template. Supports all Serilog tokens ({Level}, {Message}, {Exception}, {Properties}, etc.). When null, uses [HH:mm:ss Level] Message.

Color Mapping

Level Console Color
Verbose DarkGray
Debug Gray
Information Blue
Warning DarkYellow
Error Red
Fatal DarkRed

Colors are applied per-line and reset automatically after each message.


Troubleshooting

Symptom Likely Cause Fix
No output at all app.UseLoggerHelper() missing Add it after builder.Build()
Custom template not applied App not restarted after config change Restart the process — configuration is read at startup
No colors in CI/Docker Terminal does not support ANSI Expected behavior in non-interactive terminals; output is still written
Debug lines missing Debug not included in Levels Add "Debug" to the Routes array for this sink

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 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.
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.

Version Downloads Last Updated
5.2.2 0 7/3/2026
5.2.0 92 6/29/2026
5.1.1 108 6/19/2026
5.1.0 103 6/16/2026
5.0.8 103 6/13/2026
5.0.7 101 6/11/2026
5.0.6 108 6/10/2026
5.0.5 119 6/6/2026
5.0.4 101 6/5/2026
5.0.3 108 6/2/2026
5.0.2 134 6/1/2026
5.0.1 113 5/31/2026
5.0.0 102 5/31/2026
4.0.13 200 11/9/2025
4.0.12 169 10/24/2025
4.0.11 220 10/22/2025
4.0.10.1 206 10/12/2025
4.0.2 307 9/12/2025
4.0.0 328 8/25/2025
Loading failed