Arkn.Extensions.Logging.ApplicationInsights 0.3.2

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

Arkn.Extensions.Logging.ApplicationInsights

NuGet

Zero-config Application Insights sink for Arkn.Logging.

Forwards structured log entries to Azure Application Insights as TraceTelemetry or ExceptionTelemetry, with full context propagation.


Installation

dotnet add package Arkn.Extensions.Logging.ApplicationInsights

Requires .NET 9.0 or .NET 10.0.


Quick Start

using Arkn.Logging.Extensions;
using Arkn.Logging.Models;
using Arkn.Extensions.Logging.ApplicationInsights.Extensions;

builder.Services.AddArknLogging(log =>
{
    log.SetMinimumLevel(ArknLogLevel.Info)
       .AddConsoleSink()
       .AddApplicationInsights(ai =>
       {
           ai.ConnectionString = "InstrumentationKey=...;IngestionEndpoint=...";
           ai.MinimumLevel     = ArknLogLevel.Warning;   // only Warning+ goes to AI
           ai.RoleName         = "MyService";
       });
});

Zero-config (connection string from environment)

When ConnectionString is left null, the Application Insights SDK automatically reads the APPLICATIONINSIGHTS_CONNECTION_STRING environment variable — no code change needed between environments.

log.AddApplicationInsights(_ => { });   // reads from env var

Telemetry Mapping

Arkn level AI SeverityLevel Telemetry type
Trace Verbose TraceTelemetry
Debug Verbose TraceTelemetry
Info Information TraceTelemetry
Warning Warning TraceTelemetry
Error Error ExceptionTelemetry*
Fatal Critical ExceptionTelemetry*

* When LogEntry.Exception is not null, ExceptionTelemetry is sent; otherwise TraceTelemetry.


Context & Scope

All LogEntry.Context key-value pairs are attached as custom dimensions on every telemetry item. The LogEntry.Scope string is forwarded as the scope custom dimension.

logger.Info("Payment processed", scope: "billing", context: new()
{
    ["orderId"] = orderId,
    ["amount"]  = amount,
});
// → TraceTelemetry with customDimensions: { scope: "billing", orderId: "...", amount: "..." }

Options Reference

Property Type Default Description
ConnectionString string? null AI connection string. Falls back to env var when null.
MinimumLevel ArknLogLevel Info Entries below this level are dropped before sending.
RoleName string "Arkn" cloud_RoleName tag on all telemetry items.

License

MIT — see repository root for details.

Product 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. 
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
0.3.2 92 5/30/2026
0.3.1 106 5/28/2026
0.3.0 92 5/6/2026
0.2.0 89 5/6/2026