Skip to content

NetOffice Logging Adapter for Microsoft.Extensions.Logging #503

Description

@jozefizso

Parent

What to build

Provide an optional NetOffice adapter for Microsoft Extensions Logging (MEL). A final application supplies an application-owned ILoggerFactory; the adapter exposes it through the provider-neutral NetOffice logging contract without adding MEL to NetOfficeFw.Core.

The adapter creates and caches one MEL ILogger for each NetOffice category. It maps every NetOffice level to the corresponding MEL LogLevel, maps the stable NetOffice event identifier and name to MEL EventId, forwards the original exception object, and preserves the original named message template and arguments so configured providers receive structured properties rather than a preformatted string.

The adapter delegates filtering to the category logger's IsEnabled result before constructing avoidable state. It does not add providers, establish global filters, own scopes that NetOffice did not create, flush providers, or dispose the supplied factory. Applications remain responsible for all provider configuration and lifetime management.

The package depends only on NetOfficeFw.Core and Microsoft.Extensions.Logging.Abstractions; it must not depend on a concrete provider. Its public configuration API must make the ownership rule explicit and allow a specific Core instance to be configured. It must remain compatible with the repository's .NET Framework and strong-name requirements.

Serilog and NLog users may use this adapter through their official MEL providers. Documentation must distinguish that route from the native NetOffice adapters and warn against enabling both routes for the same Core.

Acceptance criteria

  • Installing this package is optional and does not add MEL or any MEL provider to NetOfficeFw.Core.
  • An application can configure a specific Core from an application-owned ILoggerFactory.
  • NetOffice categories select and cache the corresponding MEL category loggers.
  • NetOffice levels map correctly to all MEL levels, including disabled logging.
  • NetOffice event IDs and names map to MEL EventId.
  • Named message-template arguments remain structured properties instead of being eagerly formatted.
  • The exact original exception reaches MEL's logging call.
  • IsEnabled prevents avoidable formatting, state creation, and provider invocation.
  • The adapter neither configures nor disposes the supplied factory or its providers.
  • Tests use a test-owned in-memory ILoggerProvider to verify categories, levels, event IDs, structured properties, exception identity, filtering, and provider failure isolation.
  • Package output is compatible with the repository's .NET Framework target and signing conventions.
  • Usage guidance covers plain MEL and the Serilog/NLog-through-MEL routes without encouraging duplicate pipelines.

Blocked by

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    • Status
      Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions