Created
October 11, 2015 17:04
-
-
Save Naphier/14ec6040ffdd534b4af6 to your computer and use it in GitHub Desktop.
Replacement for Unity's debug so we can just shut it off for production
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
/// <summary> | |
/// Replacement for Unity's debug so we can just shut it off for production | |
/// </summary> | |
public class NGDebug | |
{ | |
private enum WarningLevel | |
{ all, warning, error, none } | |
private static WarningLevel warningLevel = WarningLevel.all; | |
public static void Log(object message) | |
{ | |
if (warningLevel == WarningLevel.all) | |
Debug.Log(message.ToString()); | |
} | |
public static void Log(object message, Object context) | |
{ | |
if (warningLevel == WarningLevel.all) | |
Debug.Log(message.ToString(), context); | |
} | |
public static void LogWarning(object message) | |
{ | |
if (warningLevel == WarningLevel.all || warningLevel == WarningLevel.warning ) | |
Debug.LogWarning(message.ToString()); | |
} | |
public static void LogWarning(object message, Object context) | |
{ | |
if (warningLevel == WarningLevel.all || warningLevel == WarningLevel.warning) | |
Debug.LogWarning(message.ToString(), context); | |
} | |
public static void LogError(object message) | |
{ | |
if (warningLevel == WarningLevel.all || warningLevel == WarningLevel.error) | |
Debug.LogError(message.ToString()); | |
} | |
public static void LogError(object message, Object context) | |
{ | |
if (warningLevel == WarningLevel.all || warningLevel == WarningLevel.error) | |
Debug.LogError(message.ToString(), context); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment