Initial Commit
This commit is contained in:
parent
9089cf343f
commit
accf7e787f
20 changed files with 623 additions and 0 deletions
92
Editor/Logger.cs
Normal file
92
Editor/Logger.cs
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
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}";
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue