Microsoft.Extensions.Logging.Console 10.0.0-preview.7.25380.108

About

Microsoft.Extensions.Logging.Console provides a Console logger provider implementation for Microsoft.Extensions.Logging. It provides extension methods for the ILoggingBuilder and ILoggerProviderConfiguration classes.

Key Features

How to Use

using System;
using Microsoft.Extensions.Logging;

namespace ConsoleLoggerSample
{
    class Program
    {
        static void Main(string[] args)
        {
            // Create a logger factory with a console provider
            using ILoggerFactory loggerFactory = LoggerFactory.Create(builder => builder.AddConsole());

            // Create a logger with the category name of the current class
            ILogger<Program> logger = loggerFactory.CreateLogger<Program>();

            // Log some messages with different log levels and message templates
            logger.LogTrace("This is a trace message.");
            logger.LogDebug("This is a debug message.");
            logger.LogInformation("Hello {Name}!", "World");
            logger.LogWarning("This is a warning message.");
            logger.LogError("This is an error message.");
            logger.LogCritical("This is a critical message.");

            // Use structured logging to capture complex data
            var person = new Person { Name = "Alice", Age = 25 };
            logger.LogInformation("Created a new person: {@Person}", person);

            // Use exception logging to capture the details of an exception
            try
            {
                throw new Exception("Something went wrong.");
            }
            catch (Exception ex)
            {
                logger.LogError(ex, "An exception occurred.");
            }

            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
        }
    }

    // A simple class to demonstrate structured logging
    class Person
    {
        public string Name { get; set; }
        public int Age { get; set; }
    }
}

Main Types

The main types provided by this library are:

  • ConsoleLoggerProvider
  • ConsoleLoggerSettings
  • ConsoleLoggerOptions
  • ConsoleLoggerExtensions
  • ConsoleFormatter
  • ConsoleFormatterOptions
  • JsonConsoleFormatterOptions
  • SimpleConsoleFormatterOptions

Additional Documentation

Microsoft.Extensions.Logging.Abstractions Microsoft.Extensions.Logging Microsoft.Extensions.Logging.Debug Microsoft.Extensions.Logging.EventSource Microsoft.Extensions.Logging.EventLog Microsoft.Extensions.Logging.TraceSource

Feedback & Contributing

Microsoft.Extensions.Logging.Console is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.

Showing the top 20 packages that depend on Microsoft.Extensions.Logging.Console.

Packages Downloads
Elsa.Core
Elsa is a set of workflow libraries and tools that enable super-fast workflowing capabilities in any .NET Core application. This package contains the heart and soul of what makes Elsa tick. It implements most of the abstractions defined in Elsa.Abstractions. If you reference the Elsa package, which is recommended, you don;t have to explicitly reference this package.
28
Microsoft.AspNetCore
Microsoft.AspNetCore
28
Microsoft.AspNetCore.App
Provides a default set of APIs for building an ASP.NET Core application. This package requires the ASP.NET Core runtime. This runtime is installed by the .NET Core SDK, or can be acquired separately using installers available at https://aka.ms/dotnet-download.
28
Microsoft.AspNetCore.NodeServices
Invoke Node.js modules at runtime in ASP.NET Core applications. This package was built from the source code at https://github.com/aspnet/AspNetCore/tree/509f6badec2f3162f0e50330cd9107e5624b379b
41
Microsoft.AspNetCore.NodeServices
Invoke Node.js modules at runtime in ASP.NET Core applications. This package was built from the source code at https://github.com/aspnet/AspNetCore/tree/c3acdcac86dad91c3d3fbc3b93ecc6b7ba494bdc
29
Microsoft.AspNetCore.NodeServices
Invoke Node.js modules at runtime in ASP.NET Core applications. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/a4938d07a5127ffad8466ddf703a6b5b21f4b0c9
29
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
29
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
30
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
34
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
204
Microsoft.Extensions.Hosting
.NET Core hosting and startup infrastructures for applications.
32
Microsoft.Extensions.Hosting
.NET Core hosting and startup infrastructures for applications.
5,350
Microsoft.Extensions.Hosting
.NET Core hosting and startup infrastructures for applications.
8,938
nacos-sdk-csharp.Extensions.Configuration
nacos csharp sdk
29
nacos-sdk-csharp.Extensions.Configuration
nacos csharp sdk
59
PDFsharp
PDFsharp is the Open Source library for creating and modifying PDF documents using .NET. It has an easy-to-use API that allows developers to generate or modify PDF files programmatically. PDFsharp can be used for various applications, including creating reports, invoices, and other types of documents. This package does not depend on Windows and can be used on any .NET compatible platform including Linux and macOS. See https://docs.pdfsharp.net for details.
30
PDFsharp
PDFsharp is the Open Source library for creating and modifying PDF documents using .NET. It has an easy-to-use API that allows developers to generate or modify PDF files programmatically. PDFsharp can be used for various applications, including creating reports, invoices, and other types of documents. This package does not depend on Windows and can be used on any .NET compatible platform including Linux and macOS. See https://docs.pdfsharp.net for details.
31
Pomelo.EntityFrameworkCore.MySql
Package Description
33
Pomelo.EntityFrameworkCore.MySql.Design
Package Description
31

https://go.microsoft.com/fwlink/?LinkID=799421

.NET Framework 4.6.2

.NET Standard 2.0

.NET 10.0

.NET 9.0

.NET 8.0

Version Downloads Last updated
10.0.0-preview.7.25380.108 1 08/15/2025
10.0.0-preview.6.25358.103 3 07/17/2025
10.0.0-preview.5.25277.114 8 06/10/2025
10.0.0-preview.4.25258.110 9 05/15/2025
10.0.0-preview.3.25171.5 9 04/26/2025
10.0.0-preview.2.25163.2 12 03/30/2025
10.0.0-preview.1.25080.5 11 03/12/2025
9.0.8 2 08/08/2025
9.0.7 3 07/13/2025
9.0.6 6 06/13/2025
9.0.5 11 05/16/2025
9.0.4 8 04/27/2025
9.0.3 11 03/12/2025
9.0.2 12 03/12/2025
9.0.1 16 01/28/2025
9.0.0 27 11/15/2024
9.0.0-rc.2.24473.5 17 11/14/2024
9.0.0-rc.1.24431.7 16 11/28/2024
9.0.0-preview.7.24405.7 15 11/14/2024
9.0.0-preview.6.24327.7 13 11/14/2024
9.0.0-preview.5.24306.7 17 11/12/2024
9.0.0-preview.4.24266.19 24 05/21/2024
9.0.0-preview.3.24172.9 19 05/05/2024
9.0.0-preview.2.24128.5 19 04/28/2024
9.0.0-preview.1.24080.9 22 05/02/2024
8.0.1 23 11/12/2024
8.0.0 198 02/04/2024
8.0.0-rc.2.23479.6 19 05/29/2024
8.0.0-rc.1.23419.4 19 04/30/2024
8.0.0-preview.7.23375.6 23 05/29/2024
8.0.0-preview.6.23329.7 30 08/07/2023
8.0.0-preview.5.23280.8 20 05/15/2024
8.0.0-preview.4.23259.5 19 05/21/2024
8.0.0-preview.3.23174.8 21 05/02/2024
8.0.0-preview.2.23128.3 19 05/02/2024
8.0.0-preview.1.23110.8 24 05/02/2024
7.0.0 44 02/02/2023
7.0.0-rc.2.22472.3 20 05/14/2024
7.0.0-rc.1.22426.10 24 05/04/2024
7.0.0-preview.7.22375.6 15 05/29/2024
7.0.0-preview.6.22324.4 23 04/24/2024
7.0.0-preview.5.22301.12 15 11/28/2024
7.0.0-preview.4.22229.4 22 05/29/2024
7.0.0-preview.3.22175.4 17 05/29/2024
7.0.0-preview.2.22152.2 21 05/29/2024
7.0.0-preview.1.22076.8 16 05/29/2024
6.0.2-mauipre.1.22102.15 18 05/11/2024
6.0.2-mauipre.1.22054.8 15 05/29/2024
6.0.1 21 11/28/2024
6.0.0 58 07/01/2022
6.0.0-rc.2.21480.5 24 05/25/2024
6.0.0-rc.1.21451.13 16 02/09/2023
6.0.0-preview.7.21377.19 15 05/29/2024
6.0.0-preview.6.21352.12 19 05/04/2024
6.0.0-preview.5.21301.5 22 05/19/2024
6.0.0-preview.4.21253.7 18 05/29/2024
6.0.0-preview.3.21201.4 17 05/29/2024
6.0.0-preview.2.21154.6 21 04/30/2024
6.0.0-preview.1.21102.12 14 05/29/2024
5.0.0-rc.2.20475.5 18 05/11/2024
5.0.0-rc.1.20451.14 23 05/20/2024
5.0.0-preview.8.20407.11 18 05/29/2024
5.0.0-preview.7.20364.11 18 05/29/2024
5.0.0-preview.6.20305.6 22 05/01/2024
5.0.0-preview.5.20278.1 20 05/23/2024
5.0.0-preview.4.20251.6 17 05/02/2024
5.0.0-preview.3.20215.2 15 05/25/2024
5.0.0-preview.1.20120.4 22 05/02/2024
3.1.32 8,977 05/12/2023
3.1.31 24 05/17/2024
3.1.30 5,402 11/03/2022
3.1.29 19 05/19/2024
3.1.28 23 05/10/2024
3.1.27 20 05/26/2024
3.1.26 19 05/23/2024
3.1.25 21 05/11/2024
3.1.14 19 05/25/2024
3.1.13 26 02/24/2023
3.1.11 31 05/29/2024
3.1.3 24 05/09/2024
3.1.1 23 05/29/2024
3.1.0-preview3.19553.2 17 11/04/2022
3.1.0-preview2.19525.4 20 05/29/2024
3.1.0-preview1.19506.1 22 05/02/2024
3.0.1 19 05/29/2024
3.0.0-rc1.19456.10 19 05/29/2024
3.0.0-preview5.19227.9 18 05/02/2024
3.0.0-preview3.19153.1 20 05/18/2024
3.0.0-preview.18572.1 16 05/29/2024
2.2.0 24 08/17/2023
2.2.0-preview3-35497 23 05/07/2024
2.2.0-preview2-35157 15 05/25/2024
2.1.0-rc1-final 24 05/13/2024
2.0.0 21 05/11/2024
1.1.2 19 05/06/2024
1.1.0 23 05/29/2024
1.1.0-preview1-final 21 05/14/2024
1.0.0 21 05/02/2024
1.0.0-rc2-final 19 05/02/2024
1.0.0-rc1-final 19 05/02/2024