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
<PackageReference Include="Arkn.Extensions.Logging.ApplicationInsights" Version="0.3.2" />
<PackageVersion Include="Arkn.Extensions.Logging.ApplicationInsights" Version="0.3.2" />
<PackageReference Include="Arkn.Extensions.Logging.ApplicationInsights" />
paket add Arkn.Extensions.Logging.ApplicationInsights --version 0.3.2
#r "nuget: Arkn.Extensions.Logging.ApplicationInsights, 0.3.2"
#:package Arkn.Extensions.Logging.ApplicationInsights@0.3.2
#addin nuget:?package=Arkn.Extensions.Logging.ApplicationInsights&version=0.3.2
#tool nuget:?package=Arkn.Extensions.Logging.ApplicationInsights&version=0.3.2
Arkn.Extensions.Logging.ApplicationInsights
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 | Versions 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. |
-
net10.0
- Arkn.Logging (>= 0.3.2)
- Microsoft.ApplicationInsights (>= 2.22.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.7)
- Microsoft.Extensions.Options (>= 10.0.7)
-
net8.0
- Arkn.Logging (>= 0.3.2)
- Microsoft.ApplicationInsights (>= 2.22.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.7)
- Microsoft.Extensions.Options (>= 10.0.7)
-
net9.0
- Arkn.Logging (>= 0.3.2)
- Microsoft.ApplicationInsights (>= 2.22.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.7)
- Microsoft.Extensions.Options (>= 10.0.7)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.