92 lines
1.9 KiB
C#
92 lines
1.9 KiB
C#
using UnityEngine;
|
|
|
|
namespace gay.lilyy.SoldAvatarBootstrap
|
|
{
|
|
public static class AvatarLogger
|
|
{
|
|
private const string Prefix = "[SoldAvatarBootstrap]";
|
|
|
|
public static bool EnableDebug { get; set; } = false;
|
|
|
|
public static void Log(string message)
|
|
{
|
|
Debug.Log(Format(message));
|
|
}
|
|
|
|
public static void LogDebug(string message)
|
|
{
|
|
if (!EnableDebug) return;
|
|
Debug.Log(Format("DEBUG: " + message));
|
|
}
|
|
|
|
public static void LogInfo(string message)
|
|
{
|
|
Debug.Log(Format(message));
|
|
}
|
|
|
|
public static void LogWarning(string message)
|
|
{
|
|
Debug.LogWarning(Format(message));
|
|
}
|
|
|
|
public static void LogError(string message)
|
|
{
|
|
Debug.LogError(Format(message));
|
|
}
|
|
|
|
public static void LogSuccess(string message)
|
|
{
|
|
Debug.Log(Format("✅ " + message));
|
|
}
|
|
|
|
private static string Format(string message)
|
|
{
|
|
return string.IsNullOrEmpty(message) ? Prefix : $"{Prefix} {message}";
|
|
}
|
|
}
|
|
|
|
public sealed class AvatarLayerGroupLogger
|
|
{
|
|
private readonly string _groupName;
|
|
|
|
public AvatarLayerGroupLogger(string groupName)
|
|
{
|
|
_groupName = groupName;
|
|
}
|
|
|
|
public void Log(string message)
|
|
{
|
|
AvatarLogger.Log(Format(message));
|
|
}
|
|
|
|
public void LogDebug(string message)
|
|
{
|
|
AvatarLogger.LogDebug(Format(message));
|
|
}
|
|
|
|
public void LogInfo(string message)
|
|
{
|
|
AvatarLogger.LogInfo(Format(message));
|
|
}
|
|
|
|
public void LogWarning(string message)
|
|
{
|
|
AvatarLogger.LogWarning(Format(message));
|
|
}
|
|
|
|
public void LogError(string message)
|
|
{
|
|
AvatarLogger.LogError(Format(message));
|
|
}
|
|
|
|
public void LogSuccess(string message)
|
|
{
|
|
AvatarLogger.LogSuccess(Format(message));
|
|
}
|
|
|
|
private string Format(string message)
|
|
{
|
|
return string.IsNullOrEmpty(message) ? $"[{_groupName}]" : $"[{_groupName}] {message}";
|
|
}
|
|
}
|
|
}
|