1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
| using UnityEngine;
public static class ColorLog { static readonly string redColorHex = "#bf5959"; static readonly string yellowColorHex = "#ffbb00"; static readonly string blueColorHex = "#5489ce"; static readonly string greenColorHex = "#3cb472"; static readonly string pinkColorHex = "#fbbac1"; static readonly int fontSize = 15; public static bool isDebug = true;
public static void Red(params object[] args) { LogError(redColorHex, args); }
public static void Red(string title, params object[] args) { LogError(redColorHex, title, args); }
public static void Yellow(params object[] args) { LogWarning(yellowColorHex, args); }
public static void Yellow(string title, params object[] args) { LogWarning(yellowColorHex, title, args); }
public static void Blue(params object[] args) { Log(blueColorHex, args); }
public static void Blue(string title, params object[] args) { Log(blueColorHex, title, args); }
public static void Green(params object[] args) { Log(greenColorHex, args); }
public static void Green(string title, params object[] args) { Log(greenColorHex, title, args); }
public static void Pink(params object[] args) { Log(pinkColorHex, args); }
public static void Pink(string title, params object[] args) { Log(pinkColorHex, title, args); }
static void Log(string color, params object[] args) { if (!isDebug) return; string content = args.Length > 0 ? string.Join(" ", args) : string.Empty; Debug.Log($"<size={fontSize}><color={color}>{content}</color></size>"); }
static void Log(string color, string title, params object[] args) { if (!isDebug) return; string content = args.Length > 0 ? string.Join(" ", args) : string.Empty; Debug.Log($"<size={fontSize}><color={color}><b>{title}</b> {content}</color></size>"); }
static void LogWarning(string color, params object[] args) { string content = args.Length > 0 ? string.Join(" ", args) : string.Empty; Debug.LogWarning($"<size={fontSize}><color={color}>{content}</color></size>"); }
static void LogWarning(string color, string title, params object[] args) { string content = args.Length > 0 ? string.Join(" ", args) : string.Empty; Debug.LogWarning($"<size={fontSize}><color={color}><b>{title}</b> {content}</color></size>"); }
static void LogError(string color, params object[] args) { string content = args.Length > 0 ? string.Join(" ", args) : string.Empty; Debug.LogError($"<size={fontSize}><color={color}>{content}</color></size>"); }
static void LogError(string color, string title, params object[] args) { string content = args.Length > 0 ? string.Join(" ", args) : string.Empty; Debug.LogError($"<size={fontSize}><color={color}><b>{title}</b> {content}</color></size>"); } }
|