0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-13 08:10:45 -05:00

62 lines
1.8 KiB
C#
Raw Normal View History

2024-05-21 19:10:17 +01:00
using SPT.Common.Http;
using SPT.Common.Models.Logging;
2024-05-21 19:10:17 +01:00
namespace SPT.Common.Utils
{
public static class ServerLog
{
public static void Custom(
string source,
string message,
EServerLogTextColor color = EServerLogTextColor.White,
EServerLogBackgroundColor backgroundColor = EServerLogBackgroundColor.Default)
{
Log(source, message, EServerLogLevel.Custom, color, backgroundColor);
}
public static void Error(string source, string message)
{
Log(source, message, EServerLogLevel.Error);
}
public static void Warn(string source, string message)
{
Log(source, message, EServerLogLevel.Warn);
}
public static void Success(string source, string message)
{
Log(source, message, EServerLogLevel.Success);
}
public static void Info(string source, string message)
{
Log(source, message, EServerLogLevel.Info);
}
2023-11-12 13:52:54 +00:00
public static void Debug(string source, string message)
{
Log(source, message, EServerLogLevel.Debug);
}
public static void Log(
string source,
string message,
EServerLogLevel level = EServerLogLevel.Info,
EServerLogTextColor color = EServerLogTextColor.White,
EServerLogBackgroundColor backgroundColor = EServerLogBackgroundColor.Default)
{
ServerLogRequest request = new ServerLogRequest
{
Source = source,
Message = message,
Level = level,
Color = color,
BackgroundColor = backgroundColor
};
RequestHandler.PostJson("/singleplayer/log", Json.Serialize(request));
}
}
}