Skip to content

Instantly share code, notes, and snippets.

@SachinGanesh
Created June 4, 2018 17:02
Show Gist options
  • Save SachinGanesh/6cec483ebedc488b9235ec7e445ff765 to your computer and use it in GitHub Desktop.
Save SachinGanesh/6cec483ebedc488b9235ec7e445ff765 to your computer and use it in GitHub Desktop.
Unity3d Custom Logger. Display called Class in the console
public class Log {
static bool ShowLogs = true;
Log(){
#if Debug
ShowLogs = true;
#else
ShowLogs = false;
#endif
}
public static void d (string message) {
Debug.Log (message);
}
public static void i (Object o, string message) {
if (ShowLogs)
Debug.Log ("<color=green>" + o + "</color> : " + message);
}
public static void i (string message) {
if (ShowLogs)
Debug.Log ("<color=green> Info </color> : " + message);
}
public static void e (Object o, string message) {
if (ShowLogs)
Debug.Log ("<color=red>" + o + "</color> : " + message);
}
public static void e (string message) {
if (ShowLogs)
Debug.Log ("<color=red> Error </color> : " + message);
}
public static void w (Object o, string message) {
if (ShowLogs)
Debug.Log ("<color=blue>" + o + "</color> : " + message);
}
public static void w (string message) {
if (ShowLogs)
Debug.Log ("<color=blue> Warning </color> : " + message);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment