Skip to content

Instantly share code, notes, and snippets.

@Ddemon26
Last active September 28, 2024 07:59
Show Gist options
  • Save Ddemon26/5ceadb7934a23900c95ef932c2f75b9f to your computer and use it in GitHub Desktop.
Save Ddemon26/5ceadb7934a23900c95ef932c2f75b9f to your computer and use it in GitHub Desktop.
using UnityEngine;
public static class Logger {
const string CLASS_NAME = "LogThisWithColor";
const string LOG_COLOR = "green";
static string ClassName => CLASS_NAME.SetPrefix();
static string SetPrefix(this string newString) => $"<color={LOG_COLOR}>[{newString}]</color>";
public static void Log(string message) => Debug.Log($"{ClassName} {message}");
public static void LogWarning(string message) => Debug.LogWarning($"{ClassName} {message}");
public static void LogError(string message) => Debug.LogError($"{ClassName} {message}");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment