ArkaSoftware.Extensions.Logger.Abstractions 2.0.0

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

ArkaSoftware.Extensions.Logger.Abstractions

ArkaSoftware.Extensions.Logger.Abstractions provides a clean and extensible structure for defining logging metadata in .NET applications. It supports both host-level and request-level logging scopes and includes centralized event ID constants for consistent and traceable logging.


🔧 Components

🧱 ArkaSoftwareEventId

Defines a list of common event IDs for various categories of application-level logging.

public class ArkaSoftwareEventId
{
    public const int PerformanceMeasurement = 1001;
    public const int DomainValidationException = 1010;
    public const int CommandValidation = 1011;
    public const int QueryValidation = 1012;
    public const int EventValidation = 1013;
}

✅ Use these constants for structured and centralized event logging across your application.


🧱 IScopeInformation

Represents information to be included in log scopes, including machine-specific or request-specific data.

public interface IScopeInformation
{
    Dictionary<string, string> HostScopeInfo { get; }
    Dictionary<string, string> RequestScopeInfo { get; }
}


🧱 ScopeInformation

(Default Implementation)

Default implementation of IScopeInformation that auto-populates useful information such as:

  • Machine name
  • 🧠 Entry point assembly
  • 🔁 Unique Request ID
public class ScopeInformation : IScopeInformation
{
    public ScopeInformation()
    {
        HostScopeInfo = new Dictionary<string, string>
        {
            {"MachineName", Environment.MachineName},
            {"EntryPoint", Assembly.GetEntryAssembly()!.GetName().Name! }
        };

        RequestScopeInfo = new Dictionary<string, string>
        {
            {"RequestId", Guid.NewGuid().ToString()}
        };
    }

    public Dictionary<string, string> HostScopeInfo { get; }
    public Dictionary<string, string> RequestScopeInfo { get; }
}


✨ Usage Example

You can inject IScopeInformation into your logging pipeline or middleware:

public class LoggingMiddleware
{
    private readonly IScopeInformation _scopeInfo;

    public LoggingMiddleware(IScopeInformation scopeInfo)
    {
        _scopeInfo = scopeInfo;
    }

    public void LogRequest()
    {
        foreach (var pair in _scopeInfo.RequestScopeInfo)
        {
            Console.WriteLine($"{pair.Key}: {pair.Value}");
        }
    }
}

✅ Benefits

  • Promotes structured, contextual logging

  • Enables centralized EventId management

  • Helps in traceability and diagnostic logging

  • Decoupled and reusable in any ASP.NET Core or .NET application


🏢 Maintained by

ArkaSoftware
📧 Email Us
🌐 Web Site Visit

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.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net9.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on ArkaSoftware.Extensions.Logger.Abstractions:

Package Downloads
Arks.Framework.Endpoints.Web

A library for building robust and standardized web endpoints in .NET applications. Includes base controllers, middleware, filters, and extensions for simplifying API development.

Arks.Framework.Utilities.OutService

A multi-purpose library for .NET developers, including utilities for working with Persian dates, strings, and unique ID generation.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0 248 4/16/2025
1.0.0 397 4/16/2024