Microsoft.Extensions.Logging.Console 9.0.13
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.
This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/a4938d07a5127ffad8466ddf703a6b5b21f4b0c9
|
157 |
|
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
|
145 |
|
Microsoft.AspNetCore.NodeServices
Invoke Node.js modules at runtime in ASP.NET Core applications.
|
145 |
|
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/2e51a0b6eba74bdf02aee71944e973487937cb99
|
145 |
|
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
|
143 |
|
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
|
143 |
|
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
|
142 |
|
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
|
141 |
|
Microsoft.AspNetCore.NodeServices
Invoke Node.js modules at runtime in ASP.NET Core applications.
|
140 |
|
Microsoft.AspNetCore.NodeServices
Invoke Node.js modules at runtime in ASP.NET Core applications.
|
139 |
|
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
|
139 |
|
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
|
139 |
|
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/7e8bbb70b266b2fdaf0b11ec47fb3077761fb6bf
|
138 |
|
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
|
138 |
|
Microsoft.AspNetCore.NodeServices
Invoke Node.js modules at runtime in ASP.NET Core applications.
|
137 |
|
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/a5920c6656c9b8cef9e1f769c28062f0ade62f60
|
137 |
|
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
|
137 |
|
Microsoft.AspNetCore.NodeServices
Invoke Node.js modules at runtime in ASP.NET Core applications.
|
136 |
|
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/1f050242559e7b90ff6c4ee7f99d92b3a5af5a62
|
134 |
.NET Framework 4.6.2
- Microsoft.Bcl.AsyncInterfaces (>= 9.0.13)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.13)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.13)
- Microsoft.Extensions.Logging.Configuration (>= 9.0.13)
- Microsoft.Extensions.Logging (>= 9.0.13)
- Microsoft.Extensions.Options (>= 9.0.13)
- System.Text.Json (>= 9.0.13)
- System.Buffers (>= 4.5.1)
.NET 8.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.13)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.13)
- Microsoft.Extensions.Logging.Configuration (>= 9.0.13)
- Microsoft.Extensions.Logging (>= 9.0.13)
- Microsoft.Extensions.Options (>= 9.0.13)
- System.Text.Json (>= 9.0.13)
.NET 9.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.13)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.13)
- Microsoft.Extensions.Logging.Configuration (>= 9.0.13)
- Microsoft.Extensions.Logging (>= 9.0.13)
- Microsoft.Extensions.Options (>= 9.0.13)
.NET Standard 2.0
- Microsoft.Bcl.AsyncInterfaces (>= 9.0.13)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.13)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.13)
- Microsoft.Extensions.Logging.Configuration (>= 9.0.13)
- Microsoft.Extensions.Logging (>= 9.0.13)
- Microsoft.Extensions.Options (>= 9.0.13)
- System.Text.Json (>= 9.0.13)
- System.Buffers (>= 4.5.1)
| Version | Downloads | Last updated |
|---|---|---|
| 11.0.0-preview.2.26159.112 | 2 | 3/12/2026 |
| 11.0.0-preview.1.26104.118 | 4 | 2/11/2026 |
| 10.0.5 | 2 | 3/16/2026 |
| 10.0.4 | 2 | 3/12/2026 |
| 10.0.3 | 4 | 2/11/2026 |
| 10.0.2 | 10 | 1/15/2026 |
| 10.0.1 | 21 | 12/10/2025 |
| 10.0.0 | 46 | 11/12/2025 |
| 10.0.0-rc.2.25502.107 | 50 | 10/15/2025 |
| 10.0.0-rc.1.25451.107 | 50 | 9/10/2025 |
| 10.0.0-preview.7.25380.108 | 53 | 8/15/2025 |
| 10.0.0-preview.6.25358.103 | 62 | 7/16/2025 |
| 10.0.0-preview.5.25277.114 | 64 | 6/11/2025 |
| 10.0.0-preview.4.25258.110 | 63 | 5/15/2025 |
| 10.0.0-preview.3.25171.5 | 65 | 4/11/2025 |
| 10.0.0-preview.2.25163.2 | 78 | 3/26/2025 |
| 10.0.0-preview.1.25080.5 | 74 | 2/28/2025 |
| 9.0.14 | 2 | 3/12/2026 |
| 9.0.13 | 4 | 2/11/2026 |
| 9.0.12 | 9 | 1/17/2026 |
| 9.0.11 | 35 | 11/12/2025 |
| 9.0.10 | 51 | 10/15/2025 |
| 9.0.9 | 56 | 9/10/2025 |
| 9.0.8 | 60 | 8/5/2025 |
| 9.0.7 | 64 | 7/15/2025 |
| 9.0.6 | 66 | 6/11/2025 |
| 9.0.5 | 70 | 5/16/2025 |
| 9.0.4 | 92 | 4/9/2025 |
| 9.0.3 | 79 | 3/15/2025 |
| 9.0.2 | 79 | 2/15/2025 |
| 9.0.1 | 103 | 1/18/2025 |
| 9.0.0 | 85 | 11/13/2024 |
| 9.0.0-rc.2.24473.5 | 79 | 10/25/2024 |
| 9.0.0-rc.1.24431.7 | 105 | 9/12/2024 |
| 9.0.0-preview.7.24405.7 | 90 | 8/14/2024 |
| 9.0.0-preview.6.24327.7 | 86 | 7/10/2024 |
| 9.0.0-preview.5.24306.7 | 99 | 6/14/2024 |
| 9.0.0-preview.4.24266.19 | 88 | 5/27/2024 |
| 9.0.0-preview.3.24172.9 | 110 | 4/19/2024 |
| 9.0.0-preview.2.24128.5 | 83 | 3/16/2024 |
| 9.0.0-preview.1.24080.9 | 92 | 2/24/2024 |
| 8.0.1 | 101 | 10/15/2024 |
| 8.0.0 | 113 | 11/18/2023 |
| 8.0.0-rc.2.23479.6 | 107 | 10/28/2023 |
| 8.0.0-rc.1.23419.4 | 104 | 9/15/2023 |
| 8.0.0-preview.7.23375.6 | 119 | 8/22/2023 |
| 8.0.0-preview.6.23329.7 | 114 | 7/20/2023 |
| 8.0.0-preview.5.23280.8 | 101 | 7/17/2023 |
| 8.0.0-preview.4.23259.5 | 106 | 5/20/2023 |
| 8.0.0-preview.3.23174.8 | 112 | 5/12/2023 |
| 8.0.0-preview.2.23128.3 | 125 | 3/25/2023 |
| 8.0.0-preview.1.23110.8 | 109 | 2/23/2023 |
| 7.0.0 | 145 | 12/3/2022 |
| 7.0.0-rc.2.22472.3 | 125 | 11/12/2022 |
| 7.0.0-rc.1.22426.10 | 99 | 9/15/2022 |
| 7.0.0-preview.7.22375.6 | 105 | 9/15/2022 |
| 7.0.0-preview.6.22324.4 | 107 | 9/15/2022 |
| 7.0.0-preview.5.22301.12 | 129 | 6/26/2022 |
| 7.0.0-preview.4.22229.4 | 121 | 7/3/2022 |
| 7.0.0-preview.3.22175.4 | 115 | 7/3/2022 |
| 7.0.0-preview.2.22152.2 | 115 | 7/3/2022 |
| 7.0.0-preview.1.22076.8 | 133 | 7/3/2022 |
| 6.0.2-mauipre.1.22102.15 | 120 | 7/3/2022 |
| 6.0.2-mauipre.1.22054.8 | 114 | 7/3/2022 |
| 6.0.1 | 71 | 11/14/2024 |
| 6.0.0 | 116 | 7/3/2022 |
| 6.0.0-rc.2.21480.5 | 121 | 7/3/2022 |
| 6.0.0-rc.1.21451.13 | 101 | 7/3/2022 |
| 6.0.0-preview.7.21377.19 | 131 | 7/3/2022 |
| 6.0.0-preview.6.21352.12 | 110 | 7/3/2022 |
| 6.0.0-preview.5.21301.5 | 126 | 7/3/2022 |
| 6.0.0-preview.4.21253.7 | 123 | 7/3/2022 |
| 6.0.0-preview.3.21201.4 | 94 | 7/3/2022 |
| 6.0.0-preview.2.21154.6 | 118 | 7/3/2022 |
| 6.0.0-preview.1.21102.12 | 118 | 7/3/2022 |
| 5.0.0 | 96 | 7/3/2022 |
| 5.0.0-rc.2.20475.5 | 133 | 7/3/2022 |
| 5.0.0-rc.1.20451.14 | 123 | 7/3/2022 |
| 5.0.0-preview.8.20407.11 | 135 | 7/3/2022 |
| 5.0.0-preview.7.20364.11 | 124 | 7/3/2022 |
| 5.0.0-preview.6.20305.6 | 142 | 7/3/2022 |
| 5.0.0-preview.5.20278.1 | 110 | 7/3/2022 |
| 5.0.0-preview.4.20251.6 | 121 | 7/3/2022 |
| 5.0.0-preview.3.20215.2 | 112 | 7/3/2022 |
| 5.0.0-preview.2.20160.3 | 117 | 7/3/2022 |
| 5.0.0-preview.1.20120.4 | 120 | 7/3/2022 |
| 3.1.32 | 112 | 2/21/2023 |
| 3.1.31 | 114 | 12/3/2022 |
| 3.1.30 | 121 | 10/28/2022 |
| 3.1.29 | 115 | 9/15/2022 |
| 3.1.28 | 136 | 9/15/2022 |
| 3.1.27 | 111 | 9/15/2022 |
| 3.1.26 | 119 | 7/3/2022 |
| 3.1.25 | 113 | 7/3/2022 |
| 3.1.24 | 115 | 7/3/2022 |
| 3.1.23 | 122 | 7/3/2022 |
| 3.1.22 | 118 | 7/3/2022 |
| 3.1.21 | 117 | 7/3/2022 |
| 3.1.20 | 105 | 7/3/2022 |
| 3.1.19 | 120 | 7/3/2022 |
| 3.1.18 | 107 | 7/3/2022 |
| 3.1.17 | 144 | 7/3/2022 |
| 3.1.16 | 111 | 7/3/2022 |
| 3.1.15 | 115 | 7/3/2022 |
| 3.1.14 | 112 | 7/3/2022 |
| 3.1.13 | 106 | 7/3/2022 |
| 3.1.12 | 121 | 7/3/2022 |
| 3.1.11 | 117 | 7/3/2022 |
| 3.1.10 | 104 | 7/3/2022 |
| 3.1.9 | 127 | 7/3/2022 |
| 3.1.8 | 125 | 7/3/2022 |
| 3.1.7 | 114 | 7/3/2022 |
| 3.1.6 | 119 | 7/3/2022 |
| 3.1.5 | 106 | 7/3/2022 |
| 3.1.4 | 129 | 7/3/2022 |
| 3.1.3 | 97 | 7/3/2022 |
| 3.1.2 | 134 | 7/3/2022 |
| 3.1.1 | 109 | 7/3/2022 |
| 3.1.0 | 117 | 7/3/2022 |
| 3.1.0-preview3.19553.2 | 105 | 7/3/2022 |
| 3.1.0-preview2.19525.4 | 118 | 7/3/2022 |
| 3.1.0-preview1.19506.1 | 114 | 7/3/2022 |
| 3.0.3 | 109 | 7/3/2022 |
| 3.0.2 | 109 | 7/3/2022 |
| 3.0.1 | 111 | 7/3/2022 |
| 3.0.0 | 109 | 6/13/2022 |
| 3.0.0-rc1.19456.10 | 118 | 7/3/2022 |
| 3.0.0-preview9.19423.4 | 122 | 7/3/2022 |
| 3.0.0-preview8.19405.4 | 128 | 7/3/2022 |
| 3.0.0-preview7.19362.4 | 104 | 7/3/2022 |
| 3.0.0-preview6.19304.6 | 115 | 7/3/2022 |
| 3.0.0-preview5.19227.9 | 114 | 7/3/2022 |
| 3.0.0-preview4.19216.2 | 117 | 7/3/2022 |
| 3.0.0-preview3.19153.1 | 125 | 7/3/2022 |
| 3.0.0-preview.19074.2 | 146 | 7/3/2022 |
| 3.0.0-preview.18572.1 | 127 | 7/3/2022 |
| 2.2.0 | 119 | 7/3/2022 |
| 2.2.0-preview3-35497 | 108 | 7/3/2022 |
| 2.2.0-preview2-35157 | 96 | 7/3/2022 |
| 2.2.0-preview1-35029 | 95 | 7/3/2022 |
| 2.1.1 | 120 | 7/3/2022 |
| 2.1.0 | 141 | 7/3/2022 |
| 2.1.0-rc1-final | 104 | 7/3/2022 |
| 2.1.0-preview2-final | 105 | 7/3/2022 |
| 2.1.0-preview1-final | 110 | 7/3/2022 |
| 2.0.2 | 102 | 7/3/2022 |
| 2.0.1 | 112 | 7/3/2022 |
| 2.0.0 | 133 | 7/3/2022 |
| 2.0.0-preview2-final | 129 | 7/3/2022 |
| 2.0.0-preview1-final | 116 | 7/3/2022 |
| 1.1.2 | 124 | 7/3/2022 |
| 1.1.1 | 108 | 7/3/2022 |
| 1.1.0 | 103 | 7/3/2022 |
| 1.1.0-preview1-final | 109 | 7/3/2022 |
| 1.0.2 | 134 | 7/3/2022 |
| 1.0.1 | 113 | 7/3/2022 |
| 1.0.0 | 114 | 7/3/2022 |
| 1.0.0-rc2-final | 101 | 7/3/2022 |
| 1.0.0-rc1-final | 121 | 7/3/2022 |