-
-
Save Frozenfire92/d5ec5dc8f3cafd81491d to your computer and use it in GitHub Desktop.
Unity logging wrapper, for better performance and usage.
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; | |
namespace Assets.Phunk.Core | |
{ | |
public static class Log | |
{ | |
#region Error | |
public static void ErrorFormat(UnityEngine.Object context, string template, params object[] args) | |
{ | |
var message = string.Format(template, args); | |
Error(context, message); | |
} | |
public static void ErrorFormat(string template, params object[] args) | |
{ | |
var message = string.Format(template, args); | |
Error(message); | |
} | |
public static void Error(object message) | |
{ | |
Debug.LogError(message); | |
} | |
public static void Error(UnityEngine.Object context, object message) | |
{ | |
Debug.LogError(message, context); | |
} | |
#endregion | |
#region Warning | |
public static void WarningFormat(UnityEngine.Object context, string template, params object[] args) | |
{ | |
var message = string.Format(template, args); | |
Warning(context, message); | |
} | |
public static void WarningFormat(string template, params object[] args) | |
{ | |
var message = string.Format(template, args); | |
Warning(message); | |
} | |
public static void Warning(object message) | |
{ | |
Debug.LogWarning(message); | |
} | |
public static void Warning(UnityEngine.Object context, object message) | |
{ | |
Debug.LogWarning(message, context); | |
} | |
#endregion | |
#region Message | |
public static void MessageFormat(UnityEngine.Object context, string template, params object[] args) | |
{ | |
var message = string.Format(template, args); | |
Message(context, message); | |
} | |
public static void MessageFormat(string template, params object[] args) | |
{ | |
var message = string.Format(template, args); | |
Message(message); | |
} | |
public static void Message(object message) | |
{ | |
Debug.Log(message); | |
} | |
public static void Message(UnityEngine.Object context, object message) | |
{ | |
Debug.Log(message, context); | |
} | |
#endregion | |
#region Verbose | |
[System.Diagnostics.Conditional("DEBUG"), System.Diagnostics.Conditional("UNITY_EDITOR")] | |
public static void VerboseFormat(UnityEngine.Object context, string template, params object[] args) | |
{ | |
var message = string.Format(template, args); | |
Verbose(context, message); | |
} | |
[System.Diagnostics.Conditional("DEBUG"), System.Diagnostics.Conditional("UNITY_EDITOR")] | |
public static void VerboseFormat(string template, params object[] args) | |
{ | |
var message = string.Format(template, args); | |
Verbose(message); | |
} | |
[System.Diagnostics.Conditional("DEBUG"), System.Diagnostics.Conditional("UNITY_EDITOR")] | |
public static void Verbose(object message) | |
{ | |
Debug.Log(string.Concat("<color=grey>[VERBOSE]</color> ", message)); | |
} | |
[System.Diagnostics.Conditional("DEBUG"), System.Diagnostics.Conditional("UNITY_EDITOR")] | |
public static void Verbose(UnityEngine.Object context, object message) | |
{ | |
Debug.Log(string.Concat("<color=grey>[VERBOSE]</color> ", message), context); | |
} | |
#endregion | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment