You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.3 KiB
C#

using System.Diagnostics.Tracing;
namespace LogStudy.EventLog.Next
2 years ago
{
internal class Program
{
static void Main(string[] args)
{
Console.WriteLine("======== 高级事件日志学习 ========");
2 years ago
//UseTest();
UseDefaultSource();
Console.WriteLine("按回车键,退出!");
//Console.ReadLine();
}
static void UseTest()
{
EventSource defaultEventSource = new EventSource("Demo");
defaultEventSource.Write("xxxxx","xxxxxxxxxxxxxxxxxxxxxxxx");
}
static void UseDefaultSource()
{
EventSourceSettings settings = EventSourceSettings.EtwSelfDescribingEventFormat | EventSourceSettings.ThrowOnEventWriteErrors;
EventSource defaultEventSource = new EventSource("Andy-DemoTest", settings, new string[] { "First", "Second" });
EventSourceOptions options = new EventSourceOptions()
{
Keywords= EventKeywords.All,
Level = EventLevel.Verbose,
Opcode = EventOpcode.Info,
Tags = EventTags.None,
ActivityOptions = EventActivityOptions.Recursive,
};
defaultEventSource.Write("xxxxx", options, "000000000000000000000000000000000000000000000000");
2 years ago
}
}
}