CSharpEssentials.LoggerHelper.Sink.Console
5.3.2
dotnet add package CSharpEssentials.LoggerHelper.Sink.Console --version 5.3.2
NuGet\Install-Package CSharpEssentials.LoggerHelper.Sink.Console -Version 5.3.2
<PackageReference Include="CSharpEssentials.LoggerHelper.Sink.Console" Version="5.3.2" />
<PackageVersion Include="CSharpEssentials.LoggerHelper.Sink.Console" Version="5.3.2" />
<PackageReference Include="CSharpEssentials.LoggerHelper.Sink.Console" />
paket add CSharpEssentials.LoggerHelper.Sink.Console --version 5.3.2
#r "nuget: CSharpEssentials.LoggerHelper.Sink.Console, 5.3.2"
#:package CSharpEssentials.LoggerHelper.Sink.Console@5.3.2
#addin nuget:?package=CSharpEssentials.LoggerHelper.Sink.Console&version=5.3.2
#tool nuget:?package=CSharpEssentials.LoggerHelper.Sink.Console&version=5.3.2
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 (the Routes entry is all you need):
{
"LoggerHelper": {
"ApplicationName": "MyApp",
"Routes": [
{ "Sink": "Console", "Levels": ["Debug", "Information", "Warning", "Error", "Fatal"] }
],
"Sinks": {
"Console": {
"OutputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] {Message}{NewLine}{Exception}"
}
}
}
}
Then register the helper and activate the pipeline:
// Program.cs
using CSharpEssentials.LoggerHelper;
var builder = WebApplication.CreateBuilder(args);
// Register the LoggerHub using your configuration provider
builder.Services.AddLoggerHelper(builder.Configuration);
var app = builder.Build();
app.UseLoggerHelper(); // ← required: activates sinks and registers middleware
Sinks.Consoleis optional. The sink works with just the route declaration.
Quick Setup — Fluent API
using CSharpEssentials.LoggerHelper;
using CSharpEssentials.LoggerHelper.Sink.Console;
using Serilog.Events;
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 (local time, full level name):
[14:23:01 Information] Application started
[14:23:02 Warning] Retry attempt 1 for endpoint /api/orders
[14:23:03 Error] Unhandled exception: Connection refused
This is the default format (no OutputTemplate); when an exception is attached, its ToString() is appended to the same line. With a custom OutputTemplate (Serilog template syntax), include {Exception} explicitly to print exceptions.
Configuration Options
| Property | Type | Default | Description |
|---|---|---|---|
OutputTemplate |
string? |
null |
Serilog output template (e.g. [{Timestamp:HH:mm:ss} {Level:u3}] {Message}{NewLine}{Exception}). When null or empty, the default [HH:mm:ss Level] Message is used. Exceptions are printed only if {Exception} is in the template. |
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() |
| 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 |
Links
| Product | Versions 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. |
-
net10.0
- CSharpEssentials.LoggerHelper (>= 5.3.2)
-
net8.0
- CSharpEssentials.LoggerHelper (>= 5.3.2)
-
net9.0
- CSharpEssentials.LoggerHelper (>= 5.3.2)
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.3.2 | 48 | 10/11/2026 |
| 5.3.1 | 55 | 10/10/2026 |
| 5.3.0 | 49 | 10/10/2026 |
| 5.2.11 | 52 | 10/9/2026 |
| 5.2.10 | 76 | 10/7/2026 |
| 5.2.9 | 80 | 10/6/2026 |
| 5.2.8 | 78 | 10/6/2026 |
| 5.2.7 | 79 | 10/6/2026 |
| 5.2.6 | 119 | 8/31/2026 |
| 5.2.4.1 | 106 | 8/27/2026 |
| 5.2.4 | 119 | 8/25/2026 |
| 5.2.3 | 104 | 8/25/2026 |
| 5.2.2.9 | 334 | 7/11/2026 |
| 5.2.2.8 | 129 | 7/11/2026 |
| 5.2.2.7 | 133 | 7/10/2026 |
| 5.2.2.6 | 123 | 7/6/2026 |
| 5.2.2.5 | 134 | 7/5/2026 |
| 5.2.2.4 | 126 | 7/5/2026 |
| 5.2.2.3 | 126 | 7/5/2026 |
| 5.2.2.2 | 143 | 7/5/2026 |