OpenUrzednik.Extensions.Logging 1.0.0

Prefix Reserved
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package OpenUrzednik.Extensions.Logging --version 1.0.0
                    
NuGet\Install-Package OpenUrzednik.Extensions.Logging -Version 1.0.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="OpenUrzednik.Extensions.Logging" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="OpenUrzednik.Extensions.Logging" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="OpenUrzednik.Extensions.Logging" />
                    
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 OpenUrzednik.Extensions.Logging --version 1.0.0
                    
#r "nuget: OpenUrzednik.Extensions.Logging, 1.0.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 OpenUrzednik.Extensions.Logging@1.0.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=OpenUrzednik.Extensions.Logging&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=OpenUrzednik.Extensions.Logging&version=1.0.0
                    
Install as a Cake Tool

OpenUrzednik.Extensions.Logging

🇵🇱 Wersja polska (skrócona)

⚠️ Unofficial: OpenUrzednik.NET is a community project. It is not affiliated with, authorized or endorsed by Narodowy Bank Polski (NBP) or any other Polish public institution.

Adapter that sends the logs of OpenUrzednik.NET clients to ILogger from Microsoft.Extensions.Logging.

Part of OpenUrzednik.NET. See the main README for an overview of the project.

Installation

dotnet add package OpenUrzednik.Extensions.Logging

Usage

using OpenUrzednik.Extensions.Logging;
using OpenUrzednik.Nbp;

var client = new NbpGoldPriceClient(httpClient,
    logger: loggerFactory.CreateOpenUrzednikLogger<NbpGoldPriceClient>());

The log category is the client's full type name (e.g. OpenUrzednik.Nbp.NbpGoldPriceClient), as with ILogger<T>. You can turn a whole provider's logs on or off by prefix:

{
  "Logging": {
    "LogLevel": {
      "OpenUrzednik.Nbp": "Debug"
    }
  }
}

If you already have an ILogger, use new OpenUrzednikLogger(logger).

Every entry has an event id (EventId with an id and a name, e.g. 1001 RequestTimedOut), fixed by the library and the same in every client of a provider; NBP lists them in NbpLogEvents and the telemetry reference. Filter by event id rather than message text, which may change.

Entries are structured: they carry named values (e.g. provider, path) and the template in {OriginalFormat}, like entries from LoggerMessage. Serilog, OpenTelemetry and other providers see them as separate properties. The message text is formatted with the invariant culture.

Entries are written while the operation's span is Activity.Current, so with tracing on, your logging setup can attach the trace and span ids to them: OpenTelemetry logging does it by itself, plain Microsoft.Extensions.Logging with ActivityTrackingOptions. See Correlating logs and traces in the OpenUrzednik.Diagnostics README.

Trimming and Native AOT

The .NET builds (net8.0, net10.0) are trimming- and Native AOT-compatible: publishing an app with trimming or Native AOT gives no warning from this package. CI checks it on every change (ADR-0014). The netstandard2.0 build (.NET Framework) isn't covered.

Dependencies

The package depends on Microsoft.Extensions.Logging.Abstractions. The core and provider packages have their own logging interfaces and don't need this dependency (ADR-0003).

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 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 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 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. 
.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 (2)

Showing the top 2 NuGet packages that depend on OpenUrzednik.Extensions.Logging:

Package Downloads
OpenUrzednik.Nbp.DependencyInjection

Unofficial Microsoft.Extensions.DependencyInjection registration for the OpenUrzednik.NET NBP clients: typed HttpClients, validated options, logging, tracing and metrics; ready for AddStandardResilienceHandler() on .NET 8 and later.

OpenUrzednik.MF.WhiteList.DependencyInjection

Unofficial Microsoft.Extensions.DependencyInjection registration for the OpenUrzednik.NET MF White List clients: typed HttpClients, validated options, logging, tracing and metrics, and logs without identifiers; ready for AddStandardResilienceHandler() on .NET 8 and later.

GitHub repositories

This package is not used by any popular GitHub repositories.