33
Logger/AbstractLogger.cs
Normal file
33
Logger/AbstractLogger.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
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);
|
||||
}
|
||||
Reference in New Issue
Block a user