Vectron.Extensions.Logging.Console.Formatter 1.0.48

dotnet add package Vectron.Extensions.Logging.Console.Formatter --version 1.0.48
NuGet\Install-Package Vectron.Extensions.Logging.Console.Formatter -Version 1.0.48
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="Vectron.Extensions.Logging.Console.Formatter" Version="1.0.48" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Vectron.Extensions.Logging.Console.Formatter --version 1.0.48
#r "nuget: Vectron.Extensions.Logging.Console.Formatter, 1.0.48"
#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.
// Install Vectron.Extensions.Logging.Console.Formatter as a Cake Addin
#addin nuget:?package=Vectron.Extensions.Logging.Console.Formatter&version=1.0.48

// Install Vectron.Extensions.Logging.Console.Formatter as a Cake Tool
#tool nuget:?package=Vectron.Extensions.Logging.Console.Formatter&version=1.0.48

Vectron.Extensions.Logging.Console.Formatter

License: MIT Build status NuGet

Vectron.Extensions.Logging.Console.Formatter provides a custom formatter for Microsoft.Extensions.Logging.Console it is based on the SimpleConsoleFormatter.

Changes with default simple formatter

  1. The message will be single line, but preserves new lines in the message.
  2. The Level text is changed to capitals and full word
        trce → TRACE
        dbug → DEBUG
        info → INFO
        warn → WARN
        fail → FAIL
        crit → CRIT
  3. implemented themes for coloring.
        Change theme by changing the FormatterOptions.Theme options.
        Buildin themes:
Option Description
MEL Use the colors like 'Microsoft.Extensions.Logging.Console'
NLog Use the colors like 'NLog'
Serilog Use the colors like 'Serilog'
None Don't colorize the output

Output examples:

Microsoft.Extensions.Logging level only
Microsoft.Extensions.Logging Full line

NLog level only
NLog Full line

Serilog level only
Serilog Full line

Setup

From code

using ILoggerFactory loggerFactory =
    LoggerFactory.Create(builder =>
        builder.AddSingleLineConsole(options =>
        {
            options.IncludeScopes = true;
            options.TimestampFormat = "HH:mm:ss ";
            options.UseUtcTimestamp = true;
        }));

With settings file

HostApplicationBuilder builder = Host.CreateApplicationBuilder(args);
builder.Logging
    .AddConsole()
    .AddSingleLineConsoleFormatter();
using IHost host = builder.Build();
{
    "Logging": {
        "Console": {
            "FormatterName": "SingleLineFormatter",
            "FormatterOptions": {
                "IncludeScopes": true,
                "TimestampFormat": "HH:mm:ss.ffff ",
                "UseUtcTimestamp": true,
            }
        }
    }
}

Authors

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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. 
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.48 334 2/22/2024
1.0.6 635 7/27/2023