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
- Allow logging to the console using the Microsoft.Extensions.Logging package.
 - Provide extension methods for the ILoggingBuilder and ILoggerProviderConfiguration classes.
 
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:
ConsoleLoggerProviderConsoleLoggerSettingsConsoleLoggerOptionsConsoleLoggerExtensionsConsoleFormatterConsoleFormatterOptionsJsonConsoleFormatterOptionsSimpleConsoleFormatterOptions
Additional Documentation
Related Packages
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
- Microsoft.Bcl.AsyncInterfaces (>= 10.0.0-rc.2.25502.107)
 - Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.0-rc.2.25502.107)
 - Microsoft.Extensions.Logging.Abstractions (>= 10.0.0-rc.2.25502.107)
 - Microsoft.Extensions.Logging.Configuration (>= 10.0.0-rc.2.25502.107)
 - Microsoft.Extensions.Logging (>= 10.0.0-rc.2.25502.107)
 - Microsoft.Extensions.Options (>= 10.0.0-rc.2.25502.107)
 - System.Text.Json (>= 10.0.0-rc.2.25502.107)
 - System.Buffers (>= 4.6.1)
 
.NET 8.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.0-rc.2.25502.107)
 - Microsoft.Extensions.Logging.Abstractions (>= 10.0.0-rc.2.25502.107)
 - Microsoft.Extensions.Logging.Configuration (>= 10.0.0-rc.2.25502.107)
 - Microsoft.Extensions.Logging (>= 10.0.0-rc.2.25502.107)
 - Microsoft.Extensions.Options (>= 10.0.0-rc.2.25502.107)
 - System.Text.Json (>= 10.0.0-rc.2.25502.107)
 
.NET 9.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.0-rc.2.25502.107)
 - Microsoft.Extensions.Logging.Abstractions (>= 10.0.0-rc.2.25502.107)
 - Microsoft.Extensions.Logging.Configuration (>= 10.0.0-rc.2.25502.107)
 - Microsoft.Extensions.Logging (>= 10.0.0-rc.2.25502.107)
 - Microsoft.Extensions.Options (>= 10.0.0-rc.2.25502.107)
 - System.Text.Json (>= 10.0.0-rc.2.25502.107)
 
.NET 10.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.0-rc.2.25502.107)
 - Microsoft.Extensions.Logging.Abstractions (>= 10.0.0-rc.2.25502.107)
 - Microsoft.Extensions.Logging.Configuration (>= 10.0.0-rc.2.25502.107)
 - Microsoft.Extensions.Logging (>= 10.0.0-rc.2.25502.107)
 - Microsoft.Extensions.Options (>= 10.0.0-rc.2.25502.107)
 
.NET Standard 2.0
- Microsoft.Bcl.AsyncInterfaces (>= 10.0.0-rc.2.25502.107)
 - Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.0-rc.2.25502.107)
 - Microsoft.Extensions.Logging.Abstractions (>= 10.0.0-rc.2.25502.107)
 - Microsoft.Extensions.Logging.Configuration (>= 10.0.0-rc.2.25502.107)
 - Microsoft.Extensions.Logging (>= 10.0.0-rc.2.25502.107)
 - Microsoft.Extensions.Options (>= 10.0.0-rc.2.25502.107)
 - System.Text.Json (>= 10.0.0-rc.2.25502.107)
 - System.Buffers (>= 4.6.1)