Skip to content

Commit ec47aab

Browse files
Update README with docs on how to use
1 parent d6b6fef commit ec47aab

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,53 @@
11
# Serilog.Enrichers.ExcelDna [![NuGet Version](http://img.shields.io/nuget/v/Serilog.Enrichers.ExcelDna.svg?style=flat)](https://www.nuget.org/packages/Serilog.Enrichers.ExcelDna/) [![License](https://img.shields.io/github/license/caioproiete/serilog-enrichers-exceldna.svg)](LICENSE)
22

3+
Enriches [Serilog](https://serilog.net) events with information from your [Excel-DNA](https://excel-dna.net) Add-in.
4+
5+
### Getting started
6+
7+
Install the [Serilog.Enrichers.ExcelDna](https://www.nuget.org/packages/Serilog.Enrichers.ExcelDna/) package from NuGet:
8+
9+
```powershell
10+
Install-Package Serilog.Enrichers.ExcelDna
11+
```
12+
13+
To apply the enricher to your logger configuration:
14+
15+
```csharp
16+
var log = new LoggerConfiguration()
17+
.Enrich.WithXllPath()
18+
// ... other configuration ...
19+
.CreateLogger();
20+
```
21+
22+
The `WithXllPath()` enricher will add an `XllPath` property to produced events.
23+
24+
### Included enrichers
25+
26+
The package includes:
27+
28+
* `WithXllPath()` - adds `XllPath` based with the value of `ExcelDnaUtil.XllPath`
29+
* `WithExcelVersion()` - adds `ExcelVersion` with the value of `ExcelDnaUtil.ExcelVersion`
30+
* `WithExcelVersionName()` - adds `ExcelVersionName` based on `ExcelDnaUtil.ExcelVersion`
31+
* `WithExcelBitness()` - adds `ExcelBitness` based `Environment.Is64BitProcess`
32+
33+
### Example of an Excel-DNA add-in using Serilog with this sink
34+
35+
In the [sample](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.
36+
37+
![Seq showing properties from Serilog.Enrichers.ExcelDna](assets/serilog-enrichers-exceldna-nuget-seq.png)
38+
39+
### Excel-DNA configuration for packing with `ExcelDnaPack`
40+
41+
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:
42+
43+
```xml
44+
<DnaLibrary Name="My Add-In" RuntimeVersion="v4.0">
45+
<ExternalLibrary Path="MyAddIn.dll" ExplicitExports="false" LoadFromBytes="true" Pack="true" />
46+
47+
<Reference Path="Serilog.dll" Pack="true" />
48+
<Reference Path="Serilog.Enrichers.ExcelDna.dll" Pack="true" />
49+
```
50+
351
---
452

553
_Copyright &copy; 2018 Caio Proiete & Contributors - Provided under the [Apache License, Version 2.0](http://apache.org/licenses/LICENSE-2.0.html)._
42.7 KB
Loading

0 commit comments

Comments
 (0)