Odin.Logging
0.9.8
dotnet add package Odin.Logging --version 0.9.8
NuGet\Install-Package Odin.Logging -Version 0.9.8
<PackageReference Include="Odin.Logging" Version="0.9.8" />
<PackageVersion Include="Odin.Logging" Version="0.9.8" />
<PackageReference Include="Odin.Logging" />
paket add Odin.Logging --version 0.9.8
#r "nuget: Odin.Logging, 0.9.8"
#:package Odin.Logging@0.9.8
#addin nuget:?package=Odin.Logging&version=0.9.8
#tool nuget:?package=Odin.Logging&version=0.9.8
About Odin.Logging
Odin.Logging, part of the OrDinary INfrastructure libraries, provides an ILoggerWrapper of T that extends .NET's ILogger of T with all the LogXXX(...) calls as provided by the .NET LoggerExtensions extension methods (and a few more), for simpler logging assertion verifications.
On Robustness...
Correctness, the prime quality of great software, is complemented by robustness. Robustness is a reflection of how well (or badly) software behaves outside of it's intended specification \ use cases.
Highly robust software very accurately communicates arising issues outside of the specification through telemetry (logging).
A best practice to achieve and continuously maintain a high level of robustness in large applications it to assert all logging and telemetry scenarios in automated tests, which is the reason for the creation of ILoggerWrapper, namely far less onerous verification of logging calls.
Getting Started
1 - Add package
Add the Odin.Logging package from NuGet to your project using the command...
dotnet add package Odin.Logging
2 - Add ILoggerWrapper<T> to DI in your startup code
var builder = WebApplication.CreateBuilder(args);
...
builder.Services.AddOdinLoggerWrapper();
3 - Configure .NET Logging and ILogger
As you normally would in startup code and configuration. Eg...
{
"Logging": {
"LogLevel": {
"Default": "Warning",
"MyApp": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting": "Information",
"System": "Warning"
}
}
}
4 - Log using ILoggerWrapper<T> instead of ILogger<T>
public class HitchHikerService(ILoggerWrapper<HitchHikerService> logger) : IHitchHikerService
{
public async Task VisitRestaurantAtEndOfUniverse()
{
...
_logger.LogError("Ford Prefect is missing!");
...
}
}
5 - Assert logging calls more simply in tests
_loggerWrapperMock.Verify(x => x.LogError(It.Is<string>(c =>
c.Contains("Ford Prefect"))), Times.Once);
// as opposed to this with ILogger
_iLoggerMock.Verify(
x => x.Log(
LogLevel.Error,
It.IsAny<EventId>(),
It.Is<It.IsAnyType>((state, _) =>
state.ToString() == "Ford Prefect is missing!"),
It.IsAny<Exception?>(),
It.IsAny<Func<It.IsAnyType, Exception?, string>>()),
Times.Once);
| 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 is compatible. 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. |
-
net10.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.1)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.1)
-
net8.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.1)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.1)
-
net9.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.1)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.1)
NuGet packages (7)
Showing the top 5 NuGet packages that depend on Odin.Logging:
| Package | Downloads |
|---|---|
|
Odin.Common
Common elements used in the OrdinaryInfrastructure libraries, including logging, design contract elements, and various other elements. Odin = OrDinary INfrastructure. |
|
|
Odin.Cryptography
Originally intended as a wrapper for ordinary use cases around .NET DataProtection APIs. Provides a simple ICryptographer concept supporting Encrypt and Decrypt. |
|
|
Odin.Data.SqlScriptsRunner
Provides a SqlScriptsRunner that supports journalled and unjournalled execution of SQL database change and other scripts. Useful for running database migration scripts at application deployment time. |
|
|
Odin.BackgroundProcessing.Hangfire
Concrete implementation of IBackgroundProcessor via Hangfire. |
|
|
Odin.Email.Mailgun
Mailgun support for IEmailSender. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.9.8 | 25 | 12/15/2025 |
| 0.9.7 | 23 | 12/15/2025 |
| 0.9.6 | 19 | 12/15/2025 |
| 0.9.5 | 21 | 12/15/2025 |
| 0.9.4 | 36 | 12/15/2025 |
| 0.9.3 | 416 | 12/11/2025 |
| 0.9.2 | 414 | 12/11/2025 |
| 0.9.1 | 489 | 12/9/2025 |
| 0.9.0 | 418 | 12/8/2025 |
| 0.4.16 | 318 | 12/7/2025 |
| 0.4.14 | 235 | 12/6/2025 |
| 0.4.13 | 355 | 12/6/2025 |
| 0.4.12 | 245 | 12/6/2025 |
| 0.4.11 | 289 | 12/5/2025 |
| 0.4.7 | 307 | 12/5/2025 |
| 0.4.6 | 337 | 12/5/2025 |
| 0.4.2 | 322 | 12/4/2025 |
| 0.4.0 | 317 | 12/4/2025 |
| 0.2.14 | 848 | 12/2/2025 |
| 0.2.10 | 557 | 11/30/2025 |
| 0.2.5 | 480 | 11/30/2025 |
| 0.2.4 | 446 | 11/30/2025 |
| 0.2.3 | 440 | 11/30/2025 |
| 0.2.2 | 331 | 11/22/2025 |
| 0.2.2-pullrequest0078-0006 | 296 | 11/6/2025 |
| 0.2.1 | 290 | 9/11/2025 |
| 0.2.0 | 274 | 8/21/2025 |
| 0.1.133 | 276 | 8/20/2025 |
| 0.1.133-fixpublish-mark0003 | 275 | 8/20/2025 |
| 0.1.132-pullrequest0071-0002 | 339 | 8/20/2025 |
| 0.1.131 | 527 | 8/20/2025 |