Microsoft.Extensions.Logging.Console 11.0.0-preview.3.26207.106

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
27
Microsoft.AspNetCore
Microsoft.AspNetCore
28
Microsoft.AspNetCore
Microsoft.AspNetCore
29
Microsoft.AspNetCore
Microsoft.AspNetCore
30
Microsoft.AspNetCore
Microsoft.AspNetCore
32
Microsoft.AspNetCore
Microsoft.AspNetCore
672
Microsoft.AspNetCore.All
Microsoft.AspNetCore.All
27
Microsoft.AspNetCore.All
Microsoft.AspNetCore.All
28
Microsoft.AspNetCore.All
Microsoft.AspNetCore.All
31
Microsoft.AspNetCore.All
Provides a default set of APIs for building an ASP.NET Core application, and also includes API for third-party integrations with ASP.NET Core. 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.
27
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
29
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
39
Microsoft.Extensions.Hosting
Hosting and startup infrastructures for applications.
149
PDFsharp-MigraDoc-GDI
MigraDoc is a .NET library that allows developers to create documents such as PDF and RTF using a high-level object model. It provides an intuitive API that simplifies the creation of documents, including text formatting, tables, images, and more. MigraDoc is widely used for generating reports, invoices, and other types of documents in various applications. This package relies on Windows Forms (GDI+) and can be used under Windows only. See https://docs.pdfsharp.net for details.
31

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

.NET Framework 4.6.2

.NET Standard 2.0

.NET 11.0

.NET 10.0

Version Downloads Last updated
11.0.0-preview.3.26207.106 1 04/16/2026
11.0.0-preview.2.26159.112 5 03/11/2026
11.0.0-preview.1.26104.118 6 02/12/2026
10.0.7 0 04/21/2026
10.0.6 1 04/16/2026
10.0.5 3 03/14/2026
10.0.4 4 03/11/2026
10.0.3 5 02/12/2026
10.0.2 6 01/15/2026
10.0.1 7 12/11/2025
10.0.0 11 11/13/2025
10.0.0-rc.2.25502.107 10 10/18/2025
10.0.0-rc.1.25451.107 12 09/11/2025
10.0.0-preview.7.25380.108 13 08/14/2025
10.0.0-preview.6.25358.103 14 07/17/2025
10.0.0-preview.5.25277.114 14 06/07/2025
10.0.0-preview.4.25258.110 14 05/16/2025
10.0.0-preview.3.25171.5 15 04/26/2025
10.0.0-preview.2.25163.2 18 03/20/2025
10.0.0-preview.1.25080.5 15 02/25/2025
9.0.15 1 04/16/2026
9.0.14 4 03/11/2026
9.0.13 6 02/12/2026
9.0.12 8 01/15/2026
9.0.11 12 11/13/2025
9.0.10 10 10/18/2025
9.0.9 12 09/11/2025
9.0.8 12 08/07/2025
9.0.7 13 07/12/2025
9.0.6 15 06/14/2025
9.0.5 16 05/16/2025
9.0.4 13 04/26/2025
9.0.3 18 03/20/2025
9.0.2 15 02/19/2025
9.0.1 18 01/18/2025
9.0.0 15 03/05/2025
9.0.0-rc.2.24473.5 18 12/13/2024
9.0.0-rc.1.24431.7 19 01/06/2025
9.0.0-preview.7.24405.7 20 12/07/2024
9.0.0-preview.6.24327.7 18 01/06/2025
9.0.0-preview.5.24306.7 22 12/06/2024
9.0.0-preview.4.24266.19 17 12/29/2024
9.0.0-preview.3.24172.9 20 11/27/2024
9.0.0-preview.2.24128.5 20 04/01/2024
9.0.0-preview.1.24080.9 22 02/15/2024
8.0.1 24 12/15/2024
8.0.0 26 03/07/2024
8.0.0-rc.2.23479.6 19 03/07/2024
8.0.0-rc.1.23419.4 20 03/09/2024
8.0.0-preview.7.23375.6 17 03/09/2024
8.0.0-preview.6.23329.7 20 03/10/2024
8.0.0-preview.5.23280.8 23 03/10/2024
8.0.0-preview.4.23259.5 20 03/10/2024
8.0.0-preview.3.23174.8 24 11/06/2023
8.0.0-preview.2.23128.3 24 11/07/2023
8.0.0-preview.1.23110.8 21 11/14/2023
7.0.0 154 08/18/2023
7.0.0-rc.2.22472.3 22 03/07/2024
7.0.0-rc.1.22426.10 19 11/06/2023
7.0.0-preview.7.22375.6 24 03/09/2024
7.0.0-preview.6.22324.4 20 11/07/2023
7.0.0-preview.5.22301.12 15 03/10/2024
7.0.0-preview.4.22229.4 21 02/28/2024
7.0.0-preview.3.22175.4 20 03/08/2024
7.0.0-preview.2.22152.2 23 11/10/2023
7.0.0-preview.1.22076.8 18 11/11/2023
6.0.2-mauipre.1.22102.15 19 03/18/2024
6.0.2-mauipre.1.22054.8 17 11/12/2023
6.0.1 17 01/18/2025
6.0.0 35 08/18/2023
6.0.0-rc.2.21480.5 18 03/18/2024
6.0.0-rc.1.21451.13 20 03/09/2024
6.0.0-preview.7.21377.19 17 03/09/2024
6.0.0-preview.6.21352.12 20 03/09/2024
6.0.0-preview.5.21301.5 25 03/09/2024
6.0.0-preview.4.21253.7 23 03/09/2024
6.0.0-preview.3.21201.4 17 03/09/2024
6.0.0-preview.2.21154.6 20 03/15/2024
6.0.0-preview.1.21102.12 23 03/08/2024
5.0.0 19 03/07/2024
5.0.0-rc.2.20475.5 21 11/14/2023
5.0.0-rc.1.20451.14 20 03/18/2024
5.0.0-preview.8.20407.11 21 03/17/2024
5.0.0-preview.7.20364.11 16 03/18/2024
5.0.0-preview.6.20305.6 25 11/09/2023
5.0.0-preview.5.20278.1 23 01/18/2025
5.0.0-preview.4.20251.6 16 01/06/2025
5.0.0-preview.3.20215.2 23 11/10/2023
5.0.0-preview.2.20160.3 20 12/16/2024
5.0.0-preview.1.20120.4 20 03/07/2024
3.1.32 22 02/26/2024
3.1.31 27 03/16/2024
3.1.30 20 03/17/2024
3.1.29 21 03/26/2024
3.1.28 28 03/07/2024
3.1.27 20 03/17/2024
3.1.26 20 03/15/2024
3.1.25 22 03/08/2024
3.1.24 22 03/18/2024
3.1.23 19 03/16/2024
3.1.22 31 03/19/2024
3.1.21 21 03/07/2024
3.1.20 19 03/08/2024
3.1.19 23 03/15/2024
3.1.18 21 03/15/2024
3.1.17 24 11/14/2023
3.1.16 23 03/19/2024
3.1.15 20 11/08/2023
3.1.14 19 03/15/2024
3.1.13 23 03/08/2024
3.1.12 25 03/15/2024
3.1.11 19 03/15/2024
3.1.10 20 03/08/2024
3.1.9 19 03/07/2024
3.1.8 18 03/17/2024
3.1.7 20 11/08/2023
3.1.6 23 11/11/2023
3.1.5 18 11/07/2023
3.1.4 25 01/08/2024
3.1.3 23 03/01/2024
3.1.2 25 03/07/2024
3.1.1 21 11/08/2023
3.1.0 23 11/12/2023
3.1.0-preview3.19553.2 22 03/09/2024
3.1.0-preview2.19525.4 22 03/11/2024
3.1.0-preview1.19506.1 25 11/13/2023
3.0.3 20 03/15/2024
3.0.2 20 03/15/2024
3.0.1 19 03/07/2024
3.0.0 22 03/07/2024
3.0.0-rc1.19456.10 19 03/17/2024
3.0.0-preview9.19423.4 28 03/10/2024
3.0.0-preview8.19405.4 22 03/09/2024
3.0.0-preview7.19362.4 18 01/06/2025
3.0.0-preview6.19304.6 22 11/11/2023
3.0.0-preview5.19227.9 21 03/15/2024
3.0.0-preview4.19216.2 20 03/15/2024
3.0.0-preview3.19153.1 21 01/16/2025
3.0.0-preview.19074.2 22 03/11/2024
3.0.0-preview.18572.1 25 03/09/2024
2.2.0 717 08/18/2023
2.2.0-preview3-35497 26 03/10/2024
2.2.0-preview2-35157 24 03/09/2024
2.2.0-preview1-35029 23 03/16/2024
2.1.1 22 03/15/2024
2.1.0 24 03/07/2024
2.1.0-rc1-final 20 11/12/2023
2.1.0-preview2-final 21 03/15/2024
2.1.0-preview1-final 26 03/16/2024
2.0.2 20 03/07/2024
2.0.1 25 11/11/2023
2.0.0 17 03/24/2024
2.0.0-preview2-final 28 11/13/2023
2.0.0-preview1-final 21 11/11/2023
1.1.2 17 03/15/2024
1.1.1 16 01/18/2025
1.1.0 18 03/06/2024
1.1.0-preview1-final 21 11/11/2023
1.0.2 18 11/07/2023
1.0.1 23 03/15/2024
1.0.0 20 03/07/2024
1.0.0-rc2-final 20 03/16/2024
1.0.0-rc1-final 19 03/28/2024