Microsoft.Extensions.Logging.Console 10.0.0-rc.2.25502.107

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.NodeServices
Invoke Node.js modules at runtime in ASP.NET Core applications.
114
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/b908e913e3befcfe241f3294509e6d9570acc07b
108
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/67e04394e98d5bfa6a5684d471a72fcbe30fd587
108
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/1aa50faa290ecda304507981cd01ed92651d5e34
106
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
103
Microsoft.AspNetCore.NodeServices
Invoke Node.js modules at runtime in ASP.NET Core applications.
103
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/c04846dc66cc97f71d83a83a15437828435f5d44
103
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/1bf292d47ac2a0ebda07d8a3f00355dd01915ad5
102
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/fbe05294ac5c88be848b4d57d60cb2657874da9b
102
Microsoft.AspNetCore.NodeServices
Invoke Node.js modules at runtime in ASP.NET Core applications.
101
Microsoft.AspNetCore.NodeServices
Invoke Node.js modules at runtime in ASP.NET Core applications. This package was built from the source at: https://github.com/aspnet/javascriptservices/tree/3265b92086cb62a98d7a486f9e8f81a77ef56afc
101
Microsoft.AspNetCore.NodeServices
Invoke Node.js modules at runtime in ASP.NET Core applications.
100
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/d4a83b27a44c35c521600e1f30ef688c874415d4
99
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/aee5e4080331553ea9dfb7fb388b6d72f715bf6a
99
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/f6897a5bb7ca767df8eb465bf15b193c878fffbf
98
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/561deb05ae2d6680206e3d4a6bc75de699585980
98
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/bd1e14b7d16b798de8a874189c89afed755a266c
97
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/e276c8174b8bfdeb70efceafa81c75f8badbc8db
97
Microsoft.AspNetCore.NodeServices
Invoke Node.js modules at runtime in ASP.NET Core applications.
97

.NET Framework 4.6.2

.NET 8.0

.NET 9.0

.NET 10.0

.NET Standard 2.0

Version Downloads Last updated
10.0.0-rc.2.25502.107 13 10/15/2025
10.0.0-rc.1.25451.107 14 9/10/2025
10.0.0-preview.7.25380.108 19 8/15/2025
10.0.0-preview.6.25358.103 30 7/16/2025
10.0.0-preview.5.25277.114 26 6/11/2025
10.0.0-preview.4.25258.110 28 5/15/2025
10.0.0-preview.3.25171.5 35 4/11/2025
10.0.0-preview.2.25163.2 40 3/26/2025
10.0.0-preview.1.25080.5 44 2/28/2025
9.0.10 12 10/15/2025
9.0.9 19 9/10/2025
9.0.8 24 8/5/2025
9.0.7 30 7/15/2025
9.0.6 30 6/11/2025
9.0.5 33 5/16/2025
9.0.4 54 4/9/2025
9.0.3 39 3/15/2025
9.0.2 41 2/15/2025
9.0.1 66 1/18/2025
9.0.0 56 11/13/2024
9.0.0-rc.2.24473.5 47 10/25/2024
9.0.0-rc.1.24431.7 73 9/12/2024
9.0.0-preview.7.24405.7 58 8/14/2024
9.0.0-preview.6.24327.7 57 7/10/2024
9.0.0-preview.5.24306.7 57 6/14/2024
9.0.0-preview.4.24266.19 62 5/27/2024
9.0.0-preview.3.24172.9 71 4/19/2024
9.0.0-preview.2.24128.5 56 3/16/2024
9.0.0-preview.1.24080.9 64 2/24/2024
8.0.1 60 10/15/2024
8.0.0 71 11/18/2023
8.0.0-rc.2.23479.6 73 10/28/2023
8.0.0-rc.1.23419.4 62 9/15/2023
8.0.0-preview.7.23375.6 84 8/22/2023
8.0.0-preview.6.23329.7 80 7/20/2023
8.0.0-preview.5.23280.8 70 7/17/2023
8.0.0-preview.4.23259.5 78 5/20/2023
8.0.0-preview.3.23174.8 84 5/12/2023
8.0.0-preview.2.23128.3 95 3/25/2023
8.0.0-preview.1.23110.8 69 2/23/2023
7.0.0 108 12/3/2022
7.0.0-rc.2.22472.3 99 11/12/2022
7.0.0-rc.1.22426.10 72 9/15/2022
7.0.0-preview.7.22375.6 82 9/15/2022
7.0.0-preview.6.22324.4 74 9/15/2022
7.0.0-preview.5.22301.12 82 6/26/2022
7.0.0-preview.4.22229.4 89 7/3/2022
7.0.0-preview.3.22175.4 80 7/3/2022
7.0.0-preview.2.22152.2 82 7/3/2022
7.0.0-preview.1.22076.8 97 7/3/2022
6.0.2-mauipre.1.22102.15 83 7/3/2022
6.0.2-mauipre.1.22054.8 80 7/3/2022
6.0.1 45 11/14/2024
6.0.0 76 7/3/2022
6.0.0-rc.2.21480.5 83 7/3/2022
6.0.0-rc.1.21451.13 67 7/3/2022
6.0.0-preview.7.21377.19 96 7/3/2022
6.0.0-preview.6.21352.12 84 7/3/2022
6.0.0-preview.5.21301.5 94 7/3/2022
6.0.0-preview.4.21253.7 92 7/3/2022
6.0.0-preview.3.21201.4 65 7/3/2022
6.0.0-preview.2.21154.6 82 7/3/2022
6.0.0-preview.1.21102.12 90 7/3/2022
5.0.0 69 7/3/2022
5.0.0-rc.2.20475.5 97 7/3/2022
5.0.0-rc.1.20451.14 91 7/3/2022
5.0.0-preview.8.20407.11 96 7/3/2022
5.0.0-preview.7.20364.11 96 7/3/2022
5.0.0-preview.6.20305.6 97 7/3/2022
5.0.0-preview.5.20278.1 78 7/3/2022
5.0.0-preview.4.20251.6 94 7/3/2022
5.0.0-preview.3.20215.2 90 7/3/2022
5.0.0-preview.2.20160.3 83 7/3/2022
5.0.0-preview.1.20120.4 92 7/3/2022
3.1.32 79 2/21/2023
3.1.31 82 12/3/2022
3.1.30 87 10/28/2022
3.1.29 78 9/15/2022
3.1.28 109 9/15/2022
3.1.27 80 9/15/2022
3.1.26 79 7/3/2022
3.1.25 73 7/3/2022
3.1.24 82 7/3/2022
3.1.23 84 7/3/2022
3.1.22 91 7/3/2022
3.1.21 95 7/3/2022
3.1.20 75 7/3/2022
3.1.19 86 7/3/2022
3.1.18 78 7/3/2022
3.1.17 113 7/3/2022
3.1.16 80 7/3/2022
3.1.15 84 7/3/2022
3.1.14 80 7/3/2022
3.1.13 79 7/3/2022
3.1.12 89 7/3/2022
3.1.11 82 7/3/2022
3.1.10 71 7/3/2022
3.1.9 92 7/3/2022
3.1.8 84 7/3/2022
3.1.7 83 7/3/2022
3.1.6 91 7/3/2022
3.1.5 79 7/3/2022
3.1.4 104 7/3/2022
3.1.3 64 7/3/2022
3.1.2 90 7/3/2022
3.1.1 72 7/3/2022
3.1.0 87 7/3/2022
3.1.0-preview3.19553.2 68 7/3/2022
3.1.0-preview2.19525.4 79 7/3/2022
3.1.0-preview1.19506.1 76 7/3/2022
3.0.3 76 7/3/2022
3.0.2 78 7/3/2022
3.0.1 77 7/3/2022
3.0.0 75 6/13/2022
3.0.0-rc1.19456.10 90 7/3/2022
3.0.0-preview9.19423.4 88 7/3/2022
3.0.0-preview8.19405.4 100 7/3/2022
3.0.0-preview7.19362.4 81 7/3/2022
3.0.0-preview6.19304.6 87 7/3/2022
3.0.0-preview5.19227.9 77 7/3/2022
3.0.0-preview4.19216.2 82 7/3/2022
3.0.0-preview3.19153.1 91 7/3/2022
3.0.0-preview.19074.2 105 7/3/2022
3.0.0-preview.18572.1 95 7/3/2022
2.2.0 90 7/3/2022
2.2.0-preview3-35497 80 7/3/2022
2.2.0-preview2-35157 67 7/3/2022
2.2.0-preview1-35029 62 7/3/2022
2.1.1 84 7/3/2022
2.1.0 107 7/3/2022
2.1.0-rc1-final 67 7/3/2022
2.1.0-preview2-final 76 7/3/2022
2.1.0-preview1-final 80 7/3/2022
2.0.2 71 7/3/2022
2.0.1 90 7/3/2022
2.0.0 93 7/3/2022
2.0.0-preview2-final 94 7/3/2022
2.0.0-preview1-final 77 7/3/2022
1.1.2 96 7/3/2022
1.1.1 76 7/3/2022
1.1.0 63 7/3/2022
1.1.0-preview1-final 67 7/3/2022
1.0.2 104 7/3/2022
1.0.1 86 7/3/2022
1.0.0 79 7/3/2022
1.0.0-rc2-final 69 7/3/2022
1.0.0-rc1-final 84 7/3/2022