Unity 框架

Log.cs 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace TFramework
  5. {
  6. /// <summary>
  7. /// 日志工具
  8. /// </summary>
  9. public static class Log
  10. {
  11. private readonly static string prefix = "【TFramework】:";
  12. /// <summary>
  13. /// 普通日志
  14. /// </summary>
  15. /// <param name="message"></param>
  16. public static void Info(this string message, GameObject obj = null)
  17. {
  18. Debug.Log($"<color=cyan>{prefix + message}</color>",obj);
  19. }
  20. /// <summary>
  21. /// 警告日志
  22. /// </summary>
  23. /// <param name="message"></param>
  24. public static void Warning(this string message, GameObject obj = null)
  25. {
  26. Debug.LogWarning($"<color=yellow>{prefix + message}</color>",obj);
  27. }
  28. /// <summary>
  29. /// 错误日志
  30. /// </summary>
  31. /// <param name="message"></param>
  32. public static void Error(this string message,GameObject obj=null)
  33. {
  34. Debug.LogError($"<color=red>{prefix + message}</color>",obj);
  35. }
  36. }
  37. }