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.
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Diagnostics.Tracing;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace LogStudy.EventLog
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 单例模式的事件日志源
|
|
|
|
|
/// 即是 ETW Provider
|
|
|
|
|
/// </summary>
|
|
|
|
|
[EventSource(Name ="Andy-Custom-EventSource")]
|
|
|
|
|
public sealed class DatabaseSource : EventSource
|
|
|
|
|
{
|
|
|
|
|
private DatabaseSource() { }
|
|
|
|
|
|
|
|
|
|
public static readonly DatabaseSource Instance = new DatabaseSource();
|
|
|
|
|
|
|
|
|
|
public void OnCommandExecute(string logMessage)
|
|
|
|
|
{
|
|
|
|
|
WriteEvent(1,logMessage);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|