Fix Server shutdown

This commit is contained in:
Li 2022-11-27 11:19:41 +13:00
parent 7ed10a6bca
commit 245f2d3e48
8 changed files with 276 additions and 112 deletions

View file

@ -11,7 +11,7 @@ namespace HISP.Server
private static Action<bool, string, string> logFunction = defaultCallbackFunc;
private void log(bool error, string type, string text)
private static void log(bool error, string type, string text)
{
string[] msgs = text.Replace("\r", "").Split("\n");
foreach(string msg in msgs)
@ -28,31 +28,31 @@ namespace HISP.Server
public static void ErrorPrint(string text)
{
if (ConfigReader.LogLevel >= 1)
logFunction(true, "ERROR", text);
log(true, "ERROR", text);
}
public static void WarnPrint(string text)
{
if (ConfigReader.LogLevel >= 2)
logFunction(false, "WARN", text);
log(false, "WARN", text);
}
public static void HackerPrint(string text)
{
if (ConfigReader.LogLevel >= 3)
logFunction(false, "HACK", text);
log(false, "HACK", text);
}
public static void InfoPrint(string text)
{
if (ConfigReader.LogLevel >= 4)
logFunction(false, "INFO", text);
log(false, "INFO", text);
}
public static void DebugPrint(string text)
{
if (ConfigReader.LogLevel >= 5)
logFunction(false, "DEBUG", text);
log(false, "DEBUG", text);
}
public static void CrashPrint(string text)
{
logFunction(true, "CRASH", text);
log(true, "CRASH", text);
}
}
}