Skip to content

NetOffice Logging Adapter for Serilog #501

Description

@jozefizso

Parent

What to build

Provide an optional native NetOffice adapter for Serilog. A final application supplies an application-owned Serilog.ILogger; the adapter exposes it through the provider-neutral NetOffice logging contract without requiring Microsoft Extensions Logging, a Serilog sink, or Serilog in NetOfficeFw.Core.

The adapter derives and caches a logger for each NetOffice category using Serilog's standard SourceContext property. It maps NetOffice levels to native Serilog levels, attaches the stable numeric event ID and event name as structured EventId and EventName properties, forwards the original exception, and writes the original NetOffice message template and arguments through Serilog's native template pipeline.

Level enablement must be checked before constructing avoidable event state or enriching a disabled event. The adapter must not assign or mutate the global Log.Logger, configure sinks or minimum levels, flush the pipeline, or dispose the supplied logger. The application's Serilog configuration and lifecycle remain authoritative.

The package depends only on NetOfficeFw.Core and Serilog's core package. It must not reference MEL or any sink package. Its public configuration API must accept a specific logger and configure a specific Core, with ownership behavior stated explicitly. It must remain compatible with the repository's .NET Framework and strong-name requirements.

Documentation must distinguish this native route from Serilog's MEL provider used with the Microsoft Extensions Logging adapter. Configuring both routes for one Core must be explicitly discouraged because it can duplicate every event.

Acceptance criteria

  • Installing this package is optional and does not add Serilog to NetOfficeFw.Core.
  • The adapter has no MEL or concrete sink dependency.
  • An application can configure a specific Core from an application-owned Serilog.ILogger.
  • NetOffice categories map to cached Serilog loggers enriched with SourceContext.
  • Every NetOffice level maps to the intended native Serilog level and respects native enablement.
  • Numeric event ID and event name are retained as structured EventId and EventName properties.
  • Named message-template arguments remain native Serilog properties rather than a preformatted string.
  • The exact original exception reaches the Serilog event.
  • Disabled events avoid unnecessary enrichment, argument processing, and sink invocation.
  • The adapter does not mutate global Serilog state, configure sinks, flush, or dispose the supplied logger.
  • Tests use a test-owned capturing sink to verify category, level, event properties, message-template properties, exception identity, filtering, and logger failure isolation.
  • Package output is compatible with the repository's .NET Framework target and signing conventions.
  • Usage guidance explains native Serilog versus Serilog-through-MEL and prevents accidental double logging.

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