Add ability to run as a linux service

This commit is contained in:
SilicaAndPina 2022-04-15 00:07:28 +12:00
parent fb8eab0f8e
commit 1735c35a7c
30 changed files with 935 additions and 489 deletions

View file

@ -4,15 +4,15 @@ namespace HISP.Server
{
public class Logger
{
private static void defaultCallbackFunc(string txt)
private static void defaultCallbackFunc(bool error, string type, string text)
{
return;
}
private static Action<string> logFunction = defaultCallbackFunc;
private static Action<bool, string, string> logFunction = defaultCallbackFunc;
public static void SetCallback(Action<string> callback)
public static void SetCallback(Action<bool, string, string> callback)
{
logFunction = callback;
}
@ -20,27 +20,27 @@ namespace HISP.Server
public static void ErrorPrint(string text)
{
if (ConfigReader.LogLevel >= 1)
logFunction("[ERROR] " + text);
logFunction(true, "ERROR", text);
}
public static void WarnPrint(string text)
{
if (ConfigReader.LogLevel >= 2)
logFunction("[WARN] " + text);
logFunction(false, "WARN", text);
}
public static void HackerPrint(string text)
{
if (ConfigReader.LogLevel >= 3)
logFunction("[HACK] " + text);
logFunction(false, "HACK", text);
}
public static void InfoPrint(string text)
{
if (ConfigReader.LogLevel >= 4)
logFunction("[INFO] " + text);
logFunction(false, "INFO", text);
}
public static void DebugPrint(string text)
{
if (ConfigReader.LogLevel >= 5)
logFunction("[DEBUG] " + text);
logFunction(false, "DEBUG", text);
}
}
}