Skip to content

Instantly share code, notes, and snippets.

@kyubuns
Created September 5, 2020 02:57
Show Gist options
  • Save kyubuns/0d5ba6491201417c50077dde4cafd37a to your computer and use it in GitHub Desktop.
Save kyubuns/0d5ba6491201417c50077dde4cafd37a to your computer and use it in GitHub Desktop.
public static void Test()
{
SugoiLogger.Log("Battle", "ゲーム開始");
// -> Battle | ゲーム開始
var hp = 20;
var mp = 10;
SugoiLogger.Log("Battle/Status", "今のステータス", (nameof(hp), hp), (nameof(mp), mp));
// -> Battle/Status | 今のステータス | hp = 20, mp = 10
}
public static class SugoiLogger
{
public static void Log(string category, string message)
{
UnityEngine.Debug.Log($"{category} | {message}");
}
public static void Log(string category, string message, params (string, object)[] values)
{
UnityEngine.Debug.Log($"{category} | {message} | {string.Join(", ", values.Select(x => $"{x.Item1} = {x.Item2}"))}");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment