Tolitech.Logging.Extensions 1.0.0-preview.1

This is a prerelease version of Tolitech.Logging.Extensions.
dotnet add package Tolitech.Logging.Extensions --version 1.0.0-preview.1                
NuGet\Install-Package Tolitech.Logging.Extensions -Version 1.0.0-preview.1                
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="Tolitech.Logging.Extensions" Version="1.0.0-preview.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Tolitech.Logging.Extensions --version 1.0.0-preview.1                
#r "nuget: Tolitech.Logging.Extensions, 1.0.0-preview.1"                
#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.
// 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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