HISP/HorseIsleServer/LibHISP/Server/Logger.cs
2022-04-15 00:07:28 +12:00

46 lines
1.2 KiB
C#

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