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.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace LogStudy.EventLog.Next
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 示例执行器
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static class Runner
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 运行:最小示例
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static void RunMinEventSource()
|
|
|
|
|
{
|
|
|
|
|
//Console.WriteLine($"开始运行:最小示例");
|
|
|
|
|
|
|
|
|
|
MinEventSource.Logger.Log("MinEventSource info:--------------------------------------------", 12);
|
|
|
|
|
|
|
|
|
|
//Console.WriteLine($"运行结束:最小示例");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 自定义:事件ID、日志等级、关键字
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static void RunCustomEventSource()
|
|
|
|
|
{
|
|
|
|
|
CustomEventSource.Logger.AppStarted("CustomEventSource: AppStarted",22);
|
|
|
|
|
CustomEventSource.Logger.RequestStart(2);
|
|
|
|
|
CustomEventSource.Logger.RequestStop(2);
|
|
|
|
|
CustomEventSource.Logger.AppStopd(message: "CustomEventSource:AppStopd");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 高级自定义
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static void RunAdvancedEventSource()
|
|
|
|
|
{
|
|
|
|
|
AdvancedEventSource.Logger.RequestStart(2,"localhost");
|
|
|
|
|
AdvancedEventSource.Logger.RequestStop(2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 实现接口
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static void RunInterfaceEventSource()
|
|
|
|
|
{
|
|
|
|
|
ILogger logger = InterfaceEventSource.Logger;
|
|
|
|
|
|
|
|
|
|
logger.Warning("InterfaceEventSource 警告信息!");
|
|
|
|
|
logger.Error(400, "InterfaceEventSource 错误信息!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|