using UnityEngine;
using UnityEngine.Assertions;
using System.Collections;
using System;
public static class LOG
{
private static string WARN_MESSAGE = "Warning : ";
private static string ERROR_MESSAGE = "Error : ";
private static string EXCEPTION_MESSAGE = "Exception : ";
private static string INFO_MESSAGE = "Info : ";
//Each enumerated value should be a power of two
[Flags]
public enum DebugLevel
{
DEBUG_NOTHING = 0x0,
DEBUG_WARN = 0x1,
DEBUG_ERROR = 0x2,
DEBUG_EXCEPTION = 0x4,
DEBUG_INFO = 0x8
}
#if UNITY_EDITOR
public static DebugLevel m_eunmDebugLevel =
DebugLevel.DEBUG_WARN |
DebugLevel.DEBUG_ERROR |
DebugLevel.DEBUG_EXCEPTION |
DebugLevel.DEBUG_INFO;
#else
//public static DebugLevel m_eunmDebugLevel = DebugLevel.DEBUG_NOTHING;
public static DebugLevel m_eunmDebugLevel =
DebugLevel.DEBUG_WARN |
DebugLevel.DEBUG_ERROR |
DebugLevel.DEBUG_EXCEPTION |
DebugLevel.DEBUG_INFO;
#endif
public static void SetDebugLoggingLevel(DebugLevel eLevel)
{
m_eunmDebugLevel = eLevel;
}
[System.Diagnostics.Conditional("DEBUG")]
public static void ClearConsole()
{
Debug.ClearDeveloperConsole();
}
[System.Diagnostics.Conditional("DEBUG")]
public static void w(object cMessage)
{
if ((m_eunmDebugLevel & DebugLevel.DEBUG_WARN) != 0)
{
Debug.LogWarning(WARN_MESSAGE + cMessage);
}
}
[System.Diagnostics.Conditional("DEBUG")]
public static void e(object cMessage)
{
if ((m_eunmDebugLevel & DebugLevel.DEBUG_ERROR) != 0)
{
Debug.LogError(ERROR_MESSAGE + cMessage);
}
}
[System.Diagnostics.Conditional("DEBUG")]
public static void exception(object cMessage)
{
if ((m_eunmDebugLevel & DebugLevel.DEBUG_EXCEPTION) != 0)
{
Debug.LogException(new Exception(EXCEPTION_MESSAGE + cMessage));
}
}
[System.Diagnostics.Conditional("DEBUG")]
public static void d(object cMessage)
{
if ((m_eunmDebugLevel & DebugLevel.DEBUG_INFO) != 0)
{
Debug.Log(INFO_MESSAGE + cMessage);
}
}
[System.Diagnostics.Conditional("DEBUG")]
public static void Assert(bool condition)
{
UnityEngine.Assertions.Assert.IsTrue(condition);
}
}
댓글 없음:
댓글 쓰기