Skip to content

Latest commit

 

History

History
75 lines (46 loc) · 2.88 KB

README.md

File metadata and controls

75 lines (46 loc) · 2.88 KB
README.md
Serilog.Enrichers.ExcelDna

Serilog.Enrichers.ExcelDna

Enriches Serilog events with information from your Excel-DNA Add-in.

NuGet Version Stack Overflow Stack Overflow

Seq showing properties from Serilog.Enrichers.ExcelDna

Give a Star! ⭐

If you like or are using this project please give it a star. Thanks!

Getting started 🚀

Install the Serilog.Enrichers.ExcelDna package from NuGet:

Install-Package Serilog.Enrichers.ExcelDna

To apply the enricher to your logger configuration:

var log = new LoggerConfiguration()
    .Enrich.WithXllPath()
    // ... other configuration ...
    .CreateLogger();

The WithXllPath() enricher will add an XllPath property to produced events.

Included enrichers

The package includes:

  • WithXllPath() - adds XllPath based with the value of ExcelDnaUtil.XllPath
  • WithExcelVersion() - adds ExcelVersion with the value of ExcelDnaUtil.ExcelVersion
  • WithExcelVersionName() - adds ExcelVersionName based on ExcelDnaUtil.ExcelVersion
  • WithExcelBitness() - adds ExcelBitness based Environment.Is64BitProcess

Example of an Excel-DNA add-in using Serilog with this sink

In the sample folder, there's an example of an Excel-DNA add-in that uses Serilog for logging to the LogDisplay of Excel-DNA using this sink, and apply the enrichers described above.

Excel-DNA configuration for packing with ExcelDnaPack

In order for the Excel-DNA enricher to work from an add-in that was packaged using the ExcelDnaPack utility, you need to include references to Serilog.dll and Serilog.Enrichers.ExcelDna.dll in the .dna file of the add-in:

<DnaLibrary Name="My Add-In" RuntimeVersion="v4.0">
  <ExternalLibrary Path="MyAddIn.dll" ExplicitExports="false" LoadFromBytes="true" Pack="true" />

  <Reference Path="Serilog.dll" Pack="true" />
  <Reference Path="Serilog.Enrichers.ExcelDna.dll" Pack="true" />

Release History

Click on the Releases tab on GitHub.


Copyright © 2018-2023 C. Augusto Proiete & Contributors - Provided under the Apache License, Version 2.0.