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
Microsoft.AspNetCore
Microsoft.AspNetCore
35
Microsoft.AspNetCore
Microsoft.AspNetCore
36
Microsoft.AspNetCore
Microsoft.AspNetCore
37
Microsoft.AspNetCore
Microsoft.AspNetCore
41
Microsoft.AspNetCore
Microsoft.AspNetCore
42
Microsoft.AspNetCore.NodeServices
Invoke Node.js modules at runtime in ASP.NET Core applications.
35
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/2b7e994b8a304700a09617ffc5052f0d943bbcba
262
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/535da07711bd5e2d8e44c0ea10bd2c8be1a9a584
44
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/7b22a279ec975335bbb0a7cbadef2e45ee15aa9c
80
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/9699b939f94b7524a178821d78addefa5af5d750
37
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/cf2c5c9c6dca430b97aa96429b84d0da07eb77f1
35
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/d12868dd7c10ff0433c16b06d3b59d03c40d987a
36
Microsoft.Extensions.Hosting
.NET Core hosting and startup infrastructures for applications.
36
Microsoft.Extensions.Hosting
.NET Core hosting and startup infrastructures for applications.
39
Microsoft.Extensions.Hosting
.NET Core hosting and startup infrastructures for applications.
59
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
56
Pomelo.EntityFrameworkCore.MySql
Package Description
36
Pomelo.EntityFrameworkCore.MySql
Package Description
38

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-rc.1.25451.107 1 09/26/2025
10.0.0-preview.7.25380.108 4 08/17/2025
10.0.0-preview.6.25358.103 7 07/18/2025
10.0.0-preview.5.25277.114 9 06/08/2025
10.0.0-preview.4.25258.110 11 05/15/2025
10.0.0-preview.3.25171.5 9 04/16/2025
10.0.0-preview.2.25163.2 15 03/20/2025
10.0.0-preview.1.25080.5 14 02/27/2025
9.0.9 2 09/18/2025
9.0.8 3 08/16/2025
9.0.7 7 07/18/2025
9.0.6 7 06/12/2025
9.0.5 10 05/15/2025
9.0.4 14 04/16/2025
9.0.3 17 03/14/2025
9.0.2 17 02/27/2025
9.0.1 19 01/18/2025
9.0.0 22 11/14/2024
9.0.0-rc.2.24473.5 17 10/12/2024
9.0.0-rc.1.24431.7 19 09/14/2024
9.0.0-preview.7.24405.7 22 08/20/2024
9.0.0-preview.6.24327.7 21 07/13/2024
9.0.0-preview.5.24306.7 19 06/13/2024
9.0.0-preview.4.24266.19 25 05/22/2024
9.0.0-preview.3.24172.9 26 04/18/2024
9.0.0-preview.2.24128.5 24 03/12/2024
9.0.0-preview.1.24080.9 25 03/12/2024
8.0.1 20 10/10/2024
8.0.0 32 02/08/2024
8.0.0-rc.2.23479.6 26 12/21/2023
8.0.0-rc.1.23419.4 19 02/08/2024
8.0.0-preview.7.23375.6 27 02/05/2024
8.0.0-preview.6.23329.7 35 02/08/2024
8.0.0-preview.5.23280.8 26 12/27/2023
8.0.0-preview.4.23259.5 25 01/07/2024
8.0.0-preview.3.23174.8 28 02/08/2024
8.0.0-preview.2.23128.3 29 12/03/2023
8.0.0-preview.1.23110.8 31 02/08/2024
7.0.0 31 02/08/2024
7.0.0-rc.2.22472.3 27 02/08/2024
7.0.0-rc.1.22426.10 22 01/05/2024
7.0.0-preview.7.22375.6 24 02/08/2024
7.0.0-preview.6.22324.4 25 02/08/2024
7.0.0-preview.5.22301.12 27 02/08/2024
7.0.0-preview.4.22229.4 21 02/08/2024
7.0.0-preview.3.22175.4 24 02/08/2024
7.0.0-preview.2.22152.2 22 02/08/2024
7.0.0-preview.1.22076.8 27 02/08/2024
6.0.2-mauipre.1.22102.15 27 02/08/2024
6.0.2-mauipre.1.22054.8 22 02/08/2024
6.0.1 19 11/14/2024
6.0.0 40 12/08/2021
6.0.0-rc.2.21480.5 26 02/08/2024
6.0.0-rc.1.21451.13 23 02/08/2024
6.0.0-preview.7.21377.19 23 02/08/2024
6.0.0-preview.6.21352.12 28 02/08/2024
6.0.0-preview.5.21301.5 28 02/08/2024
6.0.0-preview.4.21253.7 23 01/24/2024
6.0.0-preview.3.21201.4 28 02/08/2024
6.0.0-preview.2.21154.6 24 01/20/2024
6.0.0-preview.1.21102.12 28 02/08/2024
5.0.0 26 06/17/2022
5.0.0-rc.2.20475.5 29 02/08/2024
5.0.0-rc.1.20451.14 24 02/08/2024
5.0.0-preview.8.20407.11 27 02/08/2024
5.0.0-preview.7.20364.11 25 02/08/2024
5.0.0-preview.6.20305.6 25 12/26/2023
5.0.0-preview.5.20278.1 24 02/08/2024
5.0.0-preview.4.20251.6 24 02/08/2024
5.0.0-preview.3.20215.2 27 02/08/2024
5.0.0-preview.2.20160.3 25 02/08/2024
5.0.0-preview.1.20120.4 23 12/07/2023
3.1.32 28 02/08/2024
3.1.31 29 01/17/2024
3.1.30 30 12/08/2023
3.1.29 23 02/08/2024
3.1.28 29 02/04/2024
3.1.27 25 02/08/2024
3.1.26 27 02/08/2024
3.1.25 24 12/06/2023
3.1.24 26 02/06/2024
3.1.23 22 12/15/2023
3.1.22 78 12/14/2021
3.1.21 27 01/16/2024
3.1.20 22 02/08/2024
3.1.19 23 12/05/2023
3.1.18 22 03/12/2024
3.1.17 36 07/21/2021
3.1.16 22 03/12/2024
3.1.15 19 02/08/2024
3.1.14 26 01/28/2024
3.1.13 40 03/25/2021
3.1.12 69 02/26/2021
3.1.11 39 01/27/2021
3.1.10 25 01/23/2024
3.1.9 42 10/21/2020
3.1.8 34 09/24/2020
3.1.7 29 08/24/2020
3.1.6 26 08/04/2020
3.1.5 31 07/07/2020
3.1.4 25 02/08/2024
3.1.3 28 08/24/2020
3.1.2 29 02/27/2020
3.1.1 28 02/10/2020
3.1.0 258 02/10/2020
3.1.0-preview3.19553.2 23 02/08/2024
3.1.0-preview2.19525.4 30 02/08/2024
3.1.0-preview1.19506.1 21 02/08/2024
3.0.3 26 12/19/2023
3.0.2 27 11/19/2023
3.0.1 26 11/08/2023
3.0.0 45 02/11/2020
3.0.0-rc1.19456.10 23 02/08/2024
3.0.0-preview9.19423.4 29 12/28/2023
3.0.0-preview8.19405.4 26 02/08/2024
3.0.0-preview7.19362.4 28 02/01/2024
3.0.0-preview6.19304.6 25 02/08/2024
3.0.0-preview5.19227.9 26 02/08/2024
3.0.0-preview4.19216.2 23 02/08/2024
3.0.0-preview3.19153.1 30 01/11/2024
3.0.0-preview.19074.2 25 02/08/2024
3.0.0-preview.18572.1 23 02/08/2024
2.2.0 54 06/23/2020
2.2.0-preview3-35497 26 02/08/2024
2.2.0-preview2-35157 28 01/12/2024
2.2.0-preview1-35029 25 02/08/2024
2.1.1 26 12/05/2023
2.1.0 30 02/17/2021
2.1.0-rc1-final 29 12/26/2023
2.1.0-preview2-final 27 02/08/2024
2.1.0-preview1-final 32 01/21/2024
2.0.2 23 02/08/2024
2.0.1 26 01/18/2024
2.0.0 30 12/04/2023
2.0.0-preview2-final 28 01/31/2024
2.0.0-preview1-final 32 02/08/2024
1.1.2 27 02/10/2020
1.1.1 32 02/13/2020
1.1.0 29 02/08/2024
1.1.0-preview1-final 30 01/05/2024
1.0.2 29 01/29/2024
1.0.1 28 02/08/2024
1.0.0 28 01/08/2024
1.0.0-rc2-final 24 02/08/2024
1.0.0-rc1-final 22 02/08/2024