Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/nlog/nlog.etw

NLog Target for Event Tracing for Windows (ETW)
https://github.com/nlog/nlog.etw

csharp dotnet etw netstandard20 nlog nlog-target

Last synced: 10 days ago
JSON representation

NLog Target for Event Tracing for Windows (ETW)

Awesome Lists containing this project

README

        

# NLog.Etw

[![Version](https://badge.fury.io/nu/NLog.Etw.svg)](https://www.nuget.org/packages/NLog.Etw)
[![AppVeyor](https://img.shields.io/appveyor/ci/nlog/nlog-Etw/master.svg)](https://ci.appveyor.com/project/nlog/nlog-Etw/branch/master)
[![codecov.io](https://codecov.io/github/NLog/NLog.Etw/coverage.svg?branch=master)](https://codecov.io/github/NLog/NLog.Etw?branch=master)

NLog Target for writing logevents to Event Tracing for Windows (ETW).

## Install nuget-package to your project:

> dotnet add package NLog.Etw

## Example NLog.config file

Example of `NLog.config`-file that writes to ETW:

```xml









```

## Example Custome EventSource

Example of providing own custom EventSource for writing events:

```c#
[EventSource(Name = "MyEventSourceName")]
public class MyEventSource : EventSource, NLog.Etw.INLogEventSource
{
///
[NonEvent]
public void Write(EventLevel eventLevel, string layoutMessage, LogEventInfo logEvent)
{
// TODO Call own custom logging-method
}

///
EventSource EventSource { get { return this; } }

internal readonly static MyEventSource Log = new MyEventSource();
}

var config = new NLog.Config.LoggingConfiguration();
config.AddRuleForAllLevels(new NLog.Etw.NLogEtwExtendedTarget(MyEventSource.Log) { Name = "eetw" });
NLog.LogManager.Configuration = config;
```

### Example with EtwEventCounter Target

Example of `NLog.config`-file that writes to ETW-EventCounter:

```xml









```