If you like or are using this project please give it a star. Thanks!
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.
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
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.
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" />
Click on the Releases tab on GitHub.
Copyright © 2018-2023 C. Augusto Proiete & Contributors - Provided under the Apache License, Version 2.0.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4