MaxSdkLogger.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. using System;
  2. using UnityEngine;
  3. public class MaxSdkLogger
  4. {
  5. private const string SdkTag = "AppLovin MAX";
  6. public const string KeyVerboseLoggingEnabled = "com.applovin.verbose_logging_enabled";
  7. /// <summary>
  8. /// Log debug messages.
  9. /// </summary>
  10. public static void UserDebug(string message)
  11. {
  12. if (MaxSdk.DisableAllLogs) return;
  13. Debug.Log("Debug [" + SdkTag + "] " + message);
  14. }
  15. /// <summary>
  16. /// Log debug messages when verbose logging is enabled.
  17. ///
  18. /// Verbose logging can be enabled by calling <see cref="MaxSdk.SetVerboseLogging"/> or via the Integration Manager for build time logs.
  19. /// </summary>
  20. public static void D(string message)
  21. {
  22. if (MaxSdk.DisableAllLogs && !MaxSdk.IsVerboseLoggingEnabled()) return;
  23. Debug.Log("Debug [" + SdkTag + "] " + message);
  24. }
  25. /// <summary>
  26. /// Log warning messages.
  27. /// </summary>
  28. public static void UserWarning(string message)
  29. {
  30. if (MaxSdk.DisableAllLogs) return;
  31. Debug.LogWarning("Warning [" + SdkTag + "] " + message);
  32. }
  33. /// <summary>
  34. /// Log warning messages when verbose logging is enabled.
  35. ///
  36. /// Verbose logging can be enabled by calling <see cref="MaxSdk.SetVerboseLogging"/> or via the Integration Manager for build time logs.
  37. /// </summary>
  38. public static void W(string message)
  39. {
  40. if (MaxSdk.DisableAllLogs && !MaxSdk.IsVerboseLoggingEnabled()) return;
  41. Debug.LogWarning("Warning [" + SdkTag + "] " + message);
  42. }
  43. /// <summary>
  44. /// Log error messages.
  45. /// </summary>
  46. public static void UserError(string message)
  47. {
  48. if (MaxSdk.DisableAllLogs) return;
  49. Debug.LogError("Error [" + SdkTag + "] " + message);
  50. }
  51. /// <summary>
  52. /// Log error messages when verbose logging is enabled.
  53. ///
  54. /// Verbose logging can be enabled by calling <see cref="MaxSdk.SetVerboseLogging"/> or via the Integration Manager for build time logs.
  55. /// </summary>
  56. public static void E(string message)
  57. {
  58. if (MaxSdk.DisableAllLogs && !MaxSdk.IsVerboseLoggingEnabled()) return;
  59. Debug.LogError("Error [" + SdkTag + "] " + message);
  60. }
  61. /// <summary>
  62. /// Log exceptions.
  63. /// </summary>
  64. public static void LogException(Exception exception)
  65. {
  66. if (MaxSdk.DisableAllLogs) return;
  67. Debug.LogException(exception);
  68. }
  69. }