1
This commit is contained in:
@@ -1,11 +1,15 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
#if UNITY_64
|
||||
using UnityEngine;
|
||||
#endif
|
||||
|
||||
namespace BITKit
|
||||
{
|
||||
public static class BIT4Log
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
[UnityEngine.RuntimeInitializeOnLoadMethod]
|
||||
[RuntimeInitializeOnLoadMethod]
|
||||
private static void Reload()
|
||||
{
|
||||
OnLog = null;
|
||||
@@ -21,12 +25,17 @@ namespace BITKit
|
||||
public static event Action<ConsoleColor> OnSetConsoleColor;
|
||||
public static event Action OnNextLine;
|
||||
private static Type currentType;
|
||||
#if UNITY_64
|
||||
[HideInCallstack]
|
||||
#endif
|
||||
public static void Log(object x, int debugLevel = 0, ConsoleColor color = ConsoleColor.White)
|
||||
{
|
||||
OnSetConsoleColor?.Invoke(color);
|
||||
OnLog?.Invoke(x?.ToString());
|
||||
}
|
||||
|
||||
#if UNITY_64
|
||||
[HideInCallstack]
|
||||
#endif
|
||||
public static void Log<T>(object x, int debugLevel = 0, ConsoleColor color = ConsoleColor.White)
|
||||
{
|
||||
if (currentType != typeof(T))
|
||||
@@ -41,15 +50,23 @@ namespace BITKit
|
||||
|
||||
currentType = typeof(T);
|
||||
}
|
||||
|
||||
#if UNITY_64
|
||||
[HideInCallstack]
|
||||
#endif
|
||||
public static void LogException(Exception e)
|
||||
{
|
||||
OnException?.Invoke(e);
|
||||
}
|
||||
#if UNITY_64
|
||||
[HideInCallstack]
|
||||
#endif
|
||||
public static void Warning(object x, int debugLevel = 0)
|
||||
{
|
||||
OnWarning?.Invoke(x.ToString());
|
||||
}
|
||||
#if UNITY_64
|
||||
[HideInCallstack]
|
||||
#endif
|
||||
public static void Warning<T>(object x, int debugLevel = 0)
|
||||
{
|
||||
Warning($"{typeof(T).Name}:{x}", debugLevel);
|
||||
|
Reference in New Issue
Block a user