CodeFoxtrot.ConsoleLogger 1.0.8

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

ConsoleLogger - Simple is Good

Nuget Release

  • 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:LogLevel in appsettings.json.

Target frameworks

.NET 8, .NET 9, .NET 10.

Snag_16287bf1

Single-line Format

Snag_1628ce28

Multi-line Format

Snag_162914c6

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 IConfiguration automatically, 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 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
1.0.8 98 4/20/2026
1.0.7 135 1/23/2026
1.0.6 387 11/18/2024
1.0.5 379 11/30/2023
1.0.4 474 4/23/2023
1.0.3 497 12/24/2022
1.0.2 625 7/12/2022
1.0.1 592 7/8/2022
1.0.0 609 6/24/2022