Meziantou.Extensions.Logging.InMemory
1.2.5
Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Meziantou.Extensions.Logging.InMemory --version 1.2.5
NuGet\Install-Package Meziantou.Extensions.Logging.InMemory -Version 1.2.5
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Meziantou.Extensions.Logging.InMemory" Version="1.2.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Meziantou.Extensions.Logging.InMemory" Version="1.2.5" />
<PackageReference Include="Meziantou.Extensions.Logging.InMemory" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Meziantou.Extensions.Logging.InMemory --version 1.2.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Meziantou.Extensions.Logging.InMemory, 1.2.5"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Meziantou.Extensions.Logging.InMemory@1.2.5
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Meziantou.Extensions.Logging.InMemory&version=1.2.5
#tool nuget:?package=Meziantou.Extensions.Logging.InMemory&version=1.2.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Meziantou.Extensions.Logging.InMemory
using var loggerProvider = new InMemoryLoggerProvider();
var logger = loggerProvider.CreateLogger("MyLogger");
// do stuff with the logger
// Assert
Assert.Empty(loggerProvider.Logs.Errors);
Assert.Single(loggerProvider.Logs, log => log.Message.Contains("test") && log.EventId.Id == 1);
If you are using a WebApplicationFactory
:
using var loggerProvider = new InMemoryLoggerProvider();
using var factory = new WebApplicationFactory<Program>()
.WithWebHostBuilder(builder =>
{
builder.ConfigureLogging(builder =>
{
// You can override the logging configuration if needed
//builder.SetMinimumLevel(LogLevel.Trace);
//builder.AddFilter(_ => true);
builder.Services.AddSingleton<ILoggerProvider>(loggerProvider);
});
});
Blog post about testing logging: How to test the logs from ILogger in .NET
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.5)
-
net9.0
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.5)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on Meziantou.Extensions.Logging.InMemory:
Repository | Stars |
---|---|
mehdihadeli/vertical-slice-api-template
🍰 An asp.net core template based on .Net 9, Vertical Slice Architecture, CQRS, Minimal APIs, OpenTelemetry, API Versioning and OpenAPI.
|
Version | Downloads | Last Updated |
---|---|---|
1.3.0 | 10 | 7/23/2025 |
1.2.7 | 722 | 7/13/2025 |
1.2.6 | 3,473 | 6/15/2025 |
1.2.5 | 3,314 | 5/18/2025 |
1.2.4 | 7,629 | 4/13/2025 |
1.2.3 | 7,657 | 3/16/2025 |
1.2.2 | 1,848 | 3/1/2025 |
1.2.1 | 23,047 | 11/17/2024 |
1.2.0 | 94,170 | 1/7/2024 |
1.1.0 | 565 | 1/7/2024 |
1.0.5 | 14,761 | 11/15/2023 |
1.0.2 | 4,795 | 4/10/2023 |
1.0.1 | 1,442 | 12/4/2021 |
1.0.0 | 456 | 9/6/2021 |