PXR_Log.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*******************************************************************************
  2. Copyright © 2015-2022 PICO Technology Co., Ltd.All rights reserved.
  3. NOTICE:All information contained herein is, and remains the property of
  4. PICO Technology Co., Ltd. The intellectual and technical concepts
  5. contained herein are proprietary to PICO Technology Co., Ltd. and may be
  6. covered by patents, patents in process, and are protected by trade secret or
  7. copyright law. Dissemination of this information or reproduction of this
  8. material is strictly forbidden unless prior written permission is obtained from
  9. PICO Technology Co., Ltd.
  10. *******************************************************************************/
  11. #if UNITY_ANDROID && !UNITY_EDITOR
  12. using System.Runtime.InteropServices;
  13. #endif
  14. using UnityEngine;
  15. namespace Unity.XR.PXR
  16. {
  17. public class PLog
  18. {
  19. // 7--all print, 4--info to fatal, 3--warning to fatal,
  20. // 2--error to fatal, 1--only fatal print
  21. public static LogLevel logLevel = LogLevel.LogWarn;
  22. public enum LogLevel
  23. {
  24. LogFatal = 1,
  25. LogError = 2,
  26. LogWarn = 3,
  27. LogInfo = 4,
  28. LogDebug = 5,
  29. LogVerbose,
  30. }
  31. public static void v(string tag, string message)
  32. {
  33. if (LogLevel.LogVerbose <= logLevel)
  34. Debug.Log(string.Format("{0} FrameID={1}>>>>>>{2}", tag, Time.frameCount, message));
  35. }
  36. public static void d(string tag, string message)
  37. {
  38. if (LogLevel.LogDebug <= logLevel)
  39. Debug.Log(string.Format("{0} FrameID={1}>>>>>>{2}", tag, Time.frameCount, message));
  40. }
  41. public static void i(string tag, string message)
  42. {
  43. if (LogLevel.LogInfo <= logLevel)
  44. Debug.Log(string.Format("{0} FrameID={1}>>>>>>{2}", tag, Time.frameCount, message));
  45. }
  46. public static void w(string tag, string message)
  47. {
  48. if (LogLevel.LogWarn <= logLevel)
  49. Debug.LogWarning(string.Format("{0} FrameID={1}>>>>>>{2}", tag, Time.frameCount, message));
  50. }
  51. public static void e(string tag, string message)
  52. {
  53. if (LogLevel.LogError <= logLevel)
  54. Debug.LogError(string.Format("{0} FrameID={1}>>>>>>{2}", tag, Time.frameCount, message));
  55. }
  56. public static void f(string tag, string message)
  57. {
  58. if (LogLevel.LogFatal <= logLevel)
  59. Debug.LogError(string.Format("{0} FrameID={1}>>>>>>{2}", tag, Time.frameCount, message));
  60. }
  61. }
  62. }
粤ICP备19079148号