Files
Shrink-IDC/Logger/AbstractLogger.cs
2024-12-21 01:02:31 +08:00

33 lines
956 B
C#

using Debugger;
using Shrink.Config;
namespace Shrink.Logger;
public abstract class AbstractLogger
{
private AbstractLogger? _nextLogger;
protected LogLevel LogLevel;
public void SetNextLogger(AbstractLogger? nextLogger)
{
_nextLogger = nextLogger;
}
public void LogMessage(string data, string eventName, LogLevel level, MsgType msgType, uint uin, string message)
{
//LogLevel = Info
//Config设置为Only Fatal
if (LogLevel == level)
{
//Info 3
//Fatal 0
if (LogLevel > Configuration.Instance.Config.LogLevel) return;
Log(data, eventName, msgType, uin, message);
LogManager.Instance.IsSent = true;
}
else
_nextLogger?.LogMessage(data, eventName, level, msgType, uin, message);
}
protected abstract void Log(string data, string eventName, MsgType msgType, uint uin, string message);
}