Last active
February 10, 2019 18:00
-
-
Save randalfien/ef404578d931ea55c60fb0ef8dff2b59 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
public static class MyLogger | |
{ | |
public const int LOG_TYPE_1 = 1; | |
public const int LOG_TYPE_2 = 2; | |
public const int LOG_TYPE_3 = 4; | |
public static int Flags = 1; // Bit flags to turn individual log types on/off | |
[System.Diagnostics.Conditional("DEBUG")] // All calls to this method will be stripped when compiling without the DEBUG symbol | |
public static void Log(string msg, int type = 0) | |
{ | |
if( tag == 0 || (Flags & tag) > 0 ) | |
UnityEngine.Debug.Log(msg); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a simple custom logger for Unity. If you add this to your code with:
using static MyLogger;
You can then call it directly, like this:
Log("My Message", LOG_TYPE_1);