XeonApps.Extensions.Logging.WithProperty 1.3.0

dotnet add package XeonApps.Extensions.Logging.WithProperty --version 1.3.0
                    
NuGet\Install-Package XeonApps.Extensions.Logging.WithProperty -Version 1.3.0
                    
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="XeonApps.Extensions.Logging.WithProperty" Version="1.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="XeonApps.Extensions.Logging.WithProperty" Version="1.3.0" />
                    
Directory.Packages.props
<PackageReference Include="XeonApps.Extensions.Logging.WithProperty" />
                    
Project file
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 XeonApps.Extensions.Logging.WithProperty --version 1.3.0
                    
#r "nuget: XeonApps.Extensions.Logging.WithProperty, 1.3.0"
                    
#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 XeonApps.Extensions.Logging.WithProperty@1.3.0
                    
#: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=XeonApps.Extensions.Logging.WithProperty&version=1.3.0
                    
Install as a Cake Addin
#tool nuget:?package=XeonApps.Extensions.Logging.WithProperty&version=1.3.0
                    
Install as a Cake Tool

XeonApps.Extensions.Logging.WithProperty

NuGet CI

Lightweight extension methods that attach contextual properties to structured log events through Microsoft.Extensions.Logging, without changing the original message template.

Installation

dotnet add package XeonApps.Extensions.Logging.WithProperty

Usage

using Microsoft.Extensions.Logging;

ILogger logger = loggerFactory.CreateLogger<Program>();

logger
    .WithProperty("UserId", "123")
    .LogInformation("User {User} logged in", "Jon");

// Reuse a logger with predefined context.
logger = logger
    .WithProperty("AppVersion", "1.0")
    .WithProperties(
        ("SessionId", Guid.NewGuid()),
        ("Country", "ES"));

logger.LogInformation("Event {Event} occurred", "UserLoggedOut");

// Null values are supported.
logger.WithProperty("OptionalValue", null).LogInformation("Operation completed");

The result is an ILogger; existing LogInformation, LogWarning, etc. calls and LoggerMessage.Define delegates can use it. The original logger and its category are retained. Structured-logging providers such as NLog and Serilog can consume the added key/value properties through their Microsoft logging integrations. How properties are rendered depends on the provider and its configuration.

Compatibility and behavior

The package keeps a single netstandard2.0 assembly. Its implementation does not need framework-specific APIs, so a second identical net8.0 assembly would not add functionality. CI exercises that same assembly with the logging abstractions from .NET 8, .NET 9, and .NET 10, on Linux, Windows, and macOS. .NET Standard compatibility is broader than this tested matrix; older runtimes are not claimed to have been tested by the current CI.

The Microsoft.Extensions.Logging.Abstractions dependency remains a minimum of 1.0.0, not an exact-version restriction. Applications can resolve a newer version. Keeping this minimum avoids forcing existing consumers to upgrade their logging stack just to receive fixes. The library's public API is checked against the published 1.2.7 package when packing.

Structured state implementing IEnumerable<KeyValuePair<string, object?>> is enriched. This includes ordinary Microsoft logging message templates. Arbitrary non-structured ILogger.Log<TState> state is forwarded unchanged, rather than changing its type or inventing structured properties.

Message properties come first, followed by wrapper properties from newest wrapper to oldest. Duplicate names are preserved; interpretation is up to the provider. The original message template and formatter state are retained. IsEnabled and BeginScope delegate to the underlying logger.

Array and IReadOnlyList overloads retain the supplied collection without copying it: do not mutate it while the logger is in use. The tuple overload copies its input into an owned array. The wrapper does not change provider filtering, scope behavior, or thread-safety guarantees.

Build and test

Install a stable .NET 10 SDK and the .NET/ASP.NET Core runtimes for 8, 9, and 10 (installing each corresponding SDK is sufficient). global.json selects the .NET 10 SDK and Microsoft.Testing.Platform. The tests use xUnit.net v3 with the MTP v2 integration, not the legacy VSTest adapter. Python 3.10 or later is needed only for the package-validation scripts, not to consume the library.

dotnet restore
dotnet build --configuration Release --no-restore --warnaserror
dotnet test --configuration Release --no-build --no-restore --report-trx
dotnet pack XeonApps.Extensions.Logging.WithProperty --configuration Release --output artifacts/packages --warnaserror
python3 eng/verify-package.py artifacts/packages

On Windows, use python instead of python3 where appropriate. TRX reports are written to the runner's test-results directory unless --results-directory is supplied.

CI additionally restores the freshly packed package into an isolated NuGet cache and reruns the full test suite through a PackageReference, ensuring that tests exercise the shipped DLL and not only a project reference. Package verification checks the framework asset, dependency floor, README, license, XML docs, repository commit and portable symbol package.

Releases

Package versions are declared in Directory.Build.props. The NuGet badge links to published versions; a source change or merged PR is not itself a NuGet publication.

Publication is deliberately separate from ordinary branch builds. A version-matching v* tag on master history triggers CI again; only its verified package artifacts can proceed through the nuget environment and NuGet Trusted Publishing. No permanent NuGet API key is stored by this workflow.

See the release checklist for the one-time account setup, release commands, and recovery steps, and the changelog for changes.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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.3.0 44 10/15/2026
1.2.7 79,892 9/29/2020
1.2.5 3,615 5/7/2020
1.2.3 699 5/7/2020
1.0.2 779 4/30/2020