CodeFoxtrot.ConsoleLogger
1.0.8
dotnet add package CodeFoxtrot.ConsoleLogger --version 1.0.8
NuGet\Install-Package CodeFoxtrot.ConsoleLogger -Version 1.0.8
<PackageReference Include="CodeFoxtrot.ConsoleLogger" Version="1.0.8" />
<PackageVersion Include="CodeFoxtrot.ConsoleLogger" Version="1.0.8" />
<PackageReference Include="CodeFoxtrot.ConsoleLogger" />
paket add CodeFoxtrot.ConsoleLogger --version 1.0.8
#r "nuget: CodeFoxtrot.ConsoleLogger, 1.0.8"
#:package CodeFoxtrot.ConsoleLogger@1.0.8
#addin nuget:?package=CodeFoxtrot.ConsoleLogger&version=1.0.8
#tool nuget:?package=CodeFoxtrot.ConsoleLogger&version=1.0.8
ConsoleLogger - Simple is Good
- Cross-platform implementation supporting asynchronous Console logging.
- Configurable default minimum log level.
- Single-line, Multi-line or Custom log entry formats.
- Indent multiline messages for easier reading and analysis.
- Configurable color scheme for Console log messages, for easier reading.
- Per-provider log level filtering via
Logging:ConsoleLogger:LogLevelinappsettings.json.
Target frameworks
.NET 8, .NET 9, .NET 10.

Single-line Format

Multi-line Format

How to use
Scenario #1: Quickstart
using ConsoleLoggerLibrary;
...<omitted>...
.ConfigureLogging((context, builder) =>
{
builder.ClearProviders();
builder.AddConsoleLogger();
})
Scenario #2: Using appsettings.json
When the host registers IConfiguration (e.g. via Host.CreateDefaultBuilder),
the no-arg AddConsoleLogger() automatically binds options from the
Logging:ConsoleLogger section — no need to pass IConfiguration explicitly.
appsettings.json -- all options shown
{
"Logging": {
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Error"
},
"ConsoleLogger": {
"LogMinLevel": "Debug",
"UseUtcTimestamp": false,
"MultiLineFormat": false,
"IndentMultilineMessages": true,
"EnableConsoleColors": true,
"LogLevelColors": {
"Trace": "Cyan",
"Debug": "Blue",
"Information": "Green",
"Warning": "Yellow",
"Error": "Red",
"Critical": "Magenta",
"None": "White"
}
}
}
}
Program.cs -- full file for complete context
using ConsoleLoggerLibrary;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
namespace ConsoleLoggerDemo;
internal class Program
{
static async Task Main(string[] args)
{
try
{
await Host.CreateDefaultBuilder(args)
.ConfigureLogging((context, builder) =>
{
builder.ClearProviders();
builder.AddConsoleLogger();
})
.ConfigureServices((hostContext, services) =>
{
services.AddHostedService<App>();
})
.RunConsoleAsync();
}
catch (Exception ex)
{
Console.WriteLine($"Unexpected error: {ex.Message}");
}
}
}
If your host doesn't register
IConfigurationautomatically, pass it explicitly:builder.AddConsoleLogger(context.Configuration);
Scenario #3: Using ConfigureLogging
Program.cs -- full file for complete context, all ConsoleLoggerOptions shown
using ConsoleLoggerLibrary;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
namespace ConsoleLoggerDemo;
internal class Program
{
static async Task Main(string[] args)
{
try
{
await Host.CreateDefaultBuilder(args)
.ConfigureLogging((context, builder) =>
{
builder.ClearProviders();
builder.AddConsoleLogger(configure =>
{
configure.LogMinLevel = LogLevel.Trace;
configure.UseUtcTimestamp = false;
configure.MultiLineFormat = false;
configure.IndentMultilineMessages = true;
configure.EnableConsoleColors = true;
configure.LogLevelColors = new()
{
[LogLevel.Trace] = ConsoleColor.Cyan,
[LogLevel.Debug] = ConsoleColor.Blue,
[LogLevel.Information] = ConsoleColor.Green,
[LogLevel.Warning] = ConsoleColor.Yellow,
[LogLevel.Error] = ConsoleColor.Red,
[LogLevel.Critical] = ConsoleColor.DarkRed,
[LogLevel.None] = ConsoleColor.White
};
});
})
.ConfigureServices((hostContext, services) =>
{
services.AddHostedService<App>();
})
.RunConsoleAsync();
}
catch (Exception ex)
{
Console.WriteLine($"Unexpected error: {ex.Message}");
}
}
}
Per-provider log level filtering
Because the provider registers itself via
LoggerProviderOptions.RegisterProviderOptions, you can scope per-category
log levels to just this provider (independent of the global Logging:LogLevel
section) by adding a LogLevel subsection under ConsoleLogger:
"Logging": {
"LogLevel": {
"Default": "Information"
},
"ConsoleLogger": {
"LogMinLevel": "Trace",
"LogLevel": {
"Default": "Information",
"Microsoft.Hosting.Lifetime": "Warning",
"MyApp.Diagnostics": "Trace"
}
}
}
LogMinLevel sets the floor honored by this provider. The framework's
global MinLevel is automatically lowered to match when LogMinLevel
is more permissive (e.g. Trace), so per-provider Trace/Debug entries
aren't filtered out before reaching the writer.
Indentation
IndentMultilineMessages=true
2026-04-19--18.10.20|INFO|ConsoleLoggerDemo.App|{
"Date": "4/19/2026",
"Location": "Center Moriches",
"TemperatureCelsius": 20,
"Summary": "Nice"
}
IndentMultilineMessages=false
2026-04-19--18.11.19|INFO|ConsoleLoggerDemo.App|{
"Date": "4/19/2026",
"Location": "Center Moriches",
"TemperatureCelsius": 20,
"Summary": "Nice"
}
Note: The IndentMultilineMessages option is only for the Single-Line message format.
Debugging
The package ships portable PDBs with
Source Link embedded and a
companion .snupkg symbol package. Enable "Source Link support" in
Visual Studio (or JetBrains Rider) to step into the library directly
from your debugger.
Releases
See GitHub Releases for the changelog.
Reference
https://docs.microsoft.com/en-us/dotnet/core/extensions/custom-logging-provider
| 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
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.6)
- Microsoft.Extensions.Logging (>= 10.0.6)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.6)
- Microsoft.Extensions.Logging.Configuration (>= 10.0.6)
- Microsoft.Extensions.Options (>= 10.0.6)
-
net8.0
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Logging (>= 8.0.1)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.3)
- Microsoft.Extensions.Logging.Configuration (>= 8.0.1)
- Microsoft.Extensions.Options (>= 8.0.2)
-
net9.0
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.15)
- Microsoft.Extensions.Logging (>= 9.0.15)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.15)
- Microsoft.Extensions.Logging.Configuration (>= 9.0.15)
- Microsoft.Extensions.Options (>= 9.0.15)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.