AxibugEmuOnline/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/LogManager.cs

66 lines
1.4 KiB
C#
Raw Normal View History

2024-06-28 18:08:25 +08:00
namespace AxibugEmuOnline.Client.Manager
{
public class LogManager
{
2025-01-02 15:39:13 +08:00
public LogManager(OnLogHandler logOut)
{
OnLog += logOut;
}
2024-08-16 10:20:00 +08:00
public enum E_LogType : byte
2024-06-28 18:08:25 +08:00
{
Info = 0,
Debug = 1,
Warning = 2,
Error = 3,
}
/// <summary>
/// 日志
/// </summary>
/// <param name="sk"></param>
2024-08-16 10:20:00 +08:00
public delegate void OnLogHandler(int debuglv, string msg);
2024-06-28 18:08:25 +08:00
/// <summary>
/// 内部输出
/// </summary>
2025-01-02 15:39:13 +08:00
static event OnLogHandler OnLog;
2024-06-28 18:08:25 +08:00
public void Info(string str)
{
Log(E_LogType.Info, str);
}
public void Debug(string str)
{
Log(E_LogType.Debug, str);
}
public void Warning(string str)
{
Log(E_LogType.Warning, str);
}
public void Error(string str)
{
Log(E_LogType.Error, str);
}
2025-01-02 15:39:13 +08:00
public void Assert(bool conditional, string message)
{
if (!conditional)
{
Debug(message);
}
}
2024-08-16 10:20:00 +08:00
public void Log(E_LogType logtype, string str)
2024-06-28 18:08:25 +08:00
{
OnLog?.Invoke((int)logtype, str);
}
public void Log(int logtype, string str)
{
OnLog?.Invoke(logtype, str);
}
}
}