Tolitech.Logging.Extensions
1.0.0-preview.1
dotnet add package Tolitech.Logging.Extensions --version 1.0.0-preview.1
NuGet\Install-Package Tolitech.Logging.Extensions -Version 1.0.0-preview.1
<PackageReference Include="Tolitech.Logging.Extensions" Version="1.0.0-preview.1" />
paket add Tolitech.Logging.Extensions --version 1.0.0-preview.1
#r "nuget: Tolitech.Logging.Extensions, 1.0.0-preview.1"
// Install Tolitech.Logging.Extensions as a Cake Addin #addin nuget:?package=Tolitech.Logging.Extensions&version=1.0.0-preview.1&prerelease // Install Tolitech.Logging.Extensions as a Cake Tool #tool nuget:?package=Tolitech.Logging.Extensions&version=1.0.0-preview.1&prerelease
Tolitech.Logging.Extensions
The Tolitech.Logging.Extensions library enhances logging capabilities in .NET applications using Microsoft.Extensions.Logging. It includes predefined logger message definitions for standardized logging practices across applications.
Features
- LoggerMessageDefinitions: Provides a centralized location for defining logger messages using Microsoft's LoggerMessage attribute.
- This allows for consistent logging practices and reduces redundancy in log message definitions.
Installation
You can install Tolitech.Logging.Extensions via NuGet Package Manager:
dotnet add package Tolitech.Logging.Extensions
Usage
LoggerMessageDefinitions
The LoggerMessageDefinitions class simplifies the definition of logger messages using Microsoft.Extensions.Logging. Here's an example of how to use it:
using Microsoft.Extensions.Logging;
namespace YourNamespace
{
public static class LoggerMessageDefinitions
{
[LoggerMessage(
EventId = 0,
EventName = "UnexpectedError",
Level = LogLevel.Error,
Message = "An unexpected error occurred.",
SkipEnabledCheck = true)]
public static partial void UnexpectedError(ILogger logger, Exception exception);
}
}
Logging Configuration
Ensure your logging configuration (appsettings.json or equivalent) is set up to include Tolitech.Logging.Extensions for optimal logging performance and functionality.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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. |
-
net9.0
- Microsoft.Extensions.Logging (>= 9.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0-preview.1 | 49 | 12/7/2024 |
1.0.0-alpha02 | 60 | 9/28/2024 |
1.0.0-alpha01 | 68 | 7/8/2024 |