45 lines
1.1 KiB
C#
45 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace 同步老妖联盟上下级关系.Utils
|
|
{
|
|
public class EventLog
|
|
{
|
|
/// <summary>
|
|
/// 日志事件
|
|
/// </summary>
|
|
public static event EventHandler<LogEvent> LogEvent;
|
|
|
|
public static void OnEvent(object sender, string log)
|
|
{
|
|
OnEvent(sender, new LogEvent(log));
|
|
}
|
|
/// <summary>
|
|
/// 输出日志
|
|
/// </summary>
|
|
internal static void OnEvent(object sender, LogEvent e)
|
|
{
|
|
if (LogEvent != null)
|
|
{
|
|
LogEvent.Invoke(sender, e);
|
|
}
|
|
}
|
|
}
|
|
|
|
public class LogEvent : EventArgs
|
|
{
|
|
public Exception Exception { get; internal set; }
|
|
public string Message { get; set; }
|
|
public DateTime CrtTime { get; private set; }
|
|
public LogEvent(string message)
|
|
{
|
|
this.Message = message;
|
|
this.CrtTime = DateTime.Now;
|
|
}
|
|
}
|
|
|
|
}
|