Skip to content

Instantly share code, notes, and snippets.

@d12frosted
Forked from DanPuzey/Log.cs
Last active August 29, 2015 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save d12frosted/8637fdca5e8c3629d648 to your computer and use it in GitHub Desktop.
Save d12frosted/8637fdca5e8c3629d648 to your computer and use it in GitHub Desktop.
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