Skip to content

Instantly share code, notes, and snippets.

@AndrewSav
Created April 17, 2016 08:05
Show Gist options
  • Save AndrewSav/70c0c46ba180a0770c3d7510ff392fb4 to your computer and use it in GitHub Desktop.
Save AndrewSav/70c0c46ba180a0770c3d7510ff392fb4 to your computer and use it in GitHub Desktop.
Event Provider sample for Windows IoT
using System.Diagnostics.Tracing;
namespace MyNamespace
{
[EventSource(Name = "MyEwtProvider")]
sealed class UwpEventSource : EventSource
{
public static UwpEventSource Log = new UwpEventSource();
[Event(1, Level = EventLevel.Verbose, Channel = EventChannel.Debug)]
public void Debug(string message)
{
WriteEvent(1, message);
}
[Event(2, Level = EventLevel.Informational, Channel = EventChannel.Debug)]
public void Info(string message)
{
WriteEvent(2, message);
}
[Event(3, Level = EventLevel.Warning, Channel = EventChannel.Debug)]
public void Warn(string message)
{
WriteEvent(3, message);
}
[Event(4, Level = EventLevel.Error, Channel = EventChannel.Debug)]
public void Error(string message)
{
WriteEvent(4, message);
}
[Event(5, Level = EventLevel.Critical, Channel = EventChannel.Debug)]
public void Critical(string message)
{
WriteEvent(5, message);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment