45 lines
2.1 KiB
C#
45 lines
2.1 KiB
C#
|
|
using System;
|
|
using System.Diagnostics;
|
|
using Object = UnityEngine.Object;
|
|
|
|
namespace NegUtils
|
|
{
|
|
public static class Debug
|
|
{
|
|
private const string LogDefine = "LOG_INFO";
|
|
private const string WarningDefine = "LOG_WARNING";
|
|
private const string ErrorDefine = "LOG_ERRORS";
|
|
private const string AssertDefine = "UNITY_ASSERTIONS";
|
|
private const string Editor = "UNITY_EDITOR";
|
|
|
|
[Conditional(LogDefine), Conditional(Editor)]
|
|
public static void Log(object message) => UnityEngine.Debug.Log(message);
|
|
[Conditional(LogDefine), Conditional(Editor)]
|
|
public static void Log(object message, Object context) => UnityEngine.Debug.Log(message, context);
|
|
|
|
[Conditional(WarningDefine), Conditional(Editor)]
|
|
public static void LogWarning(object message) => UnityEngine.Debug.LogWarning(message);
|
|
[Conditional(WarningDefine), Conditional(Editor)]
|
|
public static void LogWarning(object message, Object context) => UnityEngine.Debug.LogWarning(message, context);
|
|
|
|
[Conditional(ErrorDefine), Conditional(Editor)]
|
|
public static void LogError(object message) => UnityEngine.Debug.LogError(message);
|
|
[Conditional(ErrorDefine), Conditional(Editor)]
|
|
public static void LogError(object message, Object context) => UnityEngine.Debug.LogError(message, context);
|
|
|
|
public static void LogException(Exception e) => UnityEngine.Debug.LogException(e);
|
|
|
|
|
|
|
|
[Conditional(AssertDefine)]
|
|
public static void Assert(bool state) => UnityEngine.Debug.Assert(state);
|
|
[Conditional(AssertDefine)]
|
|
public static void Assert(bool state, Object context) => UnityEngine.Debug.Assert(state, context);
|
|
[Conditional(AssertDefine)]
|
|
public static void Assert(bool state, object message) => UnityEngine.Debug.Assert(state, message);
|
|
[Conditional(AssertDefine)]
|
|
public static void Assert(bool state, object message, Object context) => UnityEngine.Debug.Assert(state, message, context);
|
|
|
|
}
|
|
} |