Skip to content

Instantly share code, notes, and snippets.

@simonwittber
Last active June 3, 2021 02:48
Show Gist options
  • Save simonwittber/0f252614052da58972d3cdbb9b01ad9c to your computer and use it in GitHub Desktop.
Save simonwittber/0f252614052da58972d3cdbb9b01ad9c to your computer and use it in GitHub Desktop.
Unity Logger with Color and Headings
using UnityEngine;
public class Logger
{
string header;
public bool enabled = true;
public Logger(string name, string color)
{
header = $"<color={color}>{name}:</color>";
}
public void Log(string message)
{
if(enabled) Debug.Log($"{header} {message}");
}
public void Log(string message, params object[] things) => Log($"{message} ({string.Join(" ",things)})");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment