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: 3 months ago
JSON representation
NLog Target for Event Tracing for Windows (ETW)
- Host: GitHub
- URL: https://github.com/nlog/nlog.etw
- Owner: NLog
- License: apache-2.0
- Created: 2015-06-14T19:48:18.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2024-05-18T08:48:18.000Z (about 1 year ago)
- Last Synced: 2024-12-06T17:48:35.495Z (7 months ago)
- Topics: csharp, dotnet, etw, netstandard20, nlog, nlog-target
- Language: C#
- Homepage:
- Size: 1.13 MB
- Stars: 13
- Watchers: 7
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NLog.Etw
[](https://www.nuget.org/packages/NLog.Etw)
[](https://ci.appveyor.com/project/nlog/nlog-Etw/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
```