Zaya.Logging 1.0.0

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

Zaya.Logging

Aspect-style logging for the Zaya ecosystem: mark implementation methods with [Log], create instances through ILoggingWrapper.Wrap<T>, keep service interfaces free of logging concerns.

Packages

Package Role Who references
Zaya.Logging Abstractions: ILoggingWrapper, EmptyLoggingWrapper, LogAttribute, ILogger, ILoggable, LogLevel Host + plugins
Zaya.Logging.Impl Interface proxy (LoggingWrapper) Host only
Zaya.Logging.Impl.Microsoft MEL sink adapter + DI WrapLogging Host only

Layout mirrors OCR packages: Models/, Services/ (no source files at project root).

Future: Zaya.Logging.Impl.Serilog, etc. (sinks only — proxy stays in Impl).

These Impl packages are host NuGet dependencies, not AppData plugins (unlike Zaya.OCR.Impl.* zips).

See versioning and CHANGELOG. Package major is owned by this repo (ZayaLoggingMajor in Directory.Build.props).

Design rules

  • Want to log a step → extract a small service + interface, put [Log] on the implementation method, create via logging.Wrap<T>(...).
  • [Log] on interface methods is ignored.
  • [Log] on a class applies to all methods of the wrapped interface(s); a method-level [Log] overrides the class attribute.
  • Call entry is written when the attribute level is enabled. Use [Log(LogLevel.Trace)] if you only want the call visible at Trace.
  • For [Log] methods, exceptions are always logged at Error (when Error is enabled). The method name (± parameters) is written once: on the entry line, or on the error line if the entry was skipped — never duplicated.
  • When Trace is enabled on the sink, Wrap also logs every unmarked interface method at Trace (entry only; no forced exception logging).
  • Use EmptyLoggingWrapper.Instance when logging is off — Wrap is identity, no null checks.
  • Outer Wrap of the root service is done by the host (typically a DI factory). Nested sessions/children are wrapped inside the service via the injected ILoggingWrapper.
  • Log level enablement is fixed when the wrapper is created; changing level requires recreating the wrapper/proxies.
  • At Wrap time: methods without [Log], or with a disabled level, are not included in the logging plan (empty plan returns the same instance).

Example

using Zaya.Logging.Impl.Microsoft.Services;
using Zaya.Logging.Impl.Services;
using Zaya.Logging.Models;
using Zaya.Logging.Services;

public interface IOcrStep
{
    void Run(string path);
}

public sealed class OcrStep : IOcrStep
{
    [Log(LogLevel.Information, LogParameters = true)]
    public void Run(string path) { }
}

public sealed class Pipeline : IPipeline
{
    private readonly ILoggingWrapper _logging;
    private readonly IOcrStep _step;

    public Pipeline() : this(EmptyLoggingWrapper.Instance) { }

    public Pipeline(ILoggingWrapper logging)
    {
        _logging = logging;
        _step = logging.Wrap<IOcrStep>(new OcrStep());
    }

    [Log(LogLevel.Debug)]
    public void Execute(string path) => _step.Run(path);
}

// Host DI
services.AddSingleton<ILoggingWrapper>(sp =>
{
    var mel = sp.GetRequiredService<ILoggerFactory>().CreateLogger("Zaya");
    return new LoggingWrapper(new MicrosoftExtensionsLogger(mel));
});

services.AddSingleton<IPipeline>(sp =>
{
    var logging = sp.GetRequiredService<ILoggingWrapper>();
    return logging.Wrap<IPipeline>(new Pipeline(logging));
});

Installation (host)

<PackageReference Include="Zaya.Logging" Version="1.0.0" />
<PackageReference Include="Zaya.Logging.Impl" Version="1.0.0.0" />
<PackageReference Include="Zaya.Logging.Impl.Microsoft" Version="1.0.0.0" />

Plugins reference only Zaya.Logging (abstractions).

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

    • No dependencies.

NuGet packages (9)

Showing the top 5 NuGet packages that depend on Zaya.Logging:

Package Downloads
Zaya.OCR.Impl.ProximityTextLayout

Proximity-based text layout engine for Zaya.OCR. Merges OCR words into paragraphs using distance heuristics.

Zaya.OCR.Impl.OneOcr

OneOCR engine implementation for Zaya.OCR. Uses P/Invoke into native oneocr.dll (Windows 11 Snipping Tool OCR); no WinRT or Windows App SDK package identity required.

Zaya.Screenshot.Impl.Windows

High-performance screen capture library for Windows using Windows Graphics Capture API and Direct3D 11.

Zaya.Translator.Impl.Google

Google Translate engine for Zaya.Translator (unofficial translate.googleapis.com endpoint).

Zaya.OCR.Impl.WindowsMediaOcr

Windows.Media.Ocr engine implementation for Zaya.OCR. Uses the official WinRT OCR API (Windows 10+). Desktop hosts typically need package identity (MSIX).

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 345 8/14/2026