Files
Cielonos/Assets/OtherPlugins/GraphicsCat/Modules/Common/Misc/Logger.cs
SoulliesOfficial d15957c719 更新
2025-12-17 04:19:38 -05:00

33 lines
811 B
C#

using System.Diagnostics;
using UnityEngine;
using Debug = UnityEngine.Debug;
namespace GraphicsCat
{
public class Logger
{
public static void Log(string msg, Object context = null)
{
Debug.Log(AddCallerTag(msg), context);
}
public static void LogWarning(string msg, Object context = null)
{
Debug.LogWarning(AddCallerTag(msg));
}
public static void LogError(string msg, Object context = null)
{
Debug.LogError(AddCallerTag(msg));
}
public static string AddCallerTag(string msg)
{
var methodInfo = new StackTrace().GetFrame(2).GetMethod();
var tag = "[" + methodInfo.ReflectedType.Name + "]";
return tag + " " + msg;
}
}
}