using System; using System.Diagnostics; using UnityEngine; using Debug = UnityEngine.Debug; namespace Unity.Services.Mediation { /// /// Logger leveraging Unity console log /// static class MediationLogger { const string k_Tag = "[Mediation]"; const string k_VerboseLoggingDefine = "ENABLE_UNITY_SERVICES_MEDIATION_VERBOSE_LOGGING"; const string k_UnityAssertions = "UNITY_ASSERTIONS"; /// /// Logs a message in the console /// /// Message to log public static void Log(object message) => Debug.unityLogger.Log(k_Tag, message); /// /// Logs a warning in the console /// /// Message to log public static void LogWarning(object message) => Debug.unityLogger.LogWarning(k_Tag, message); /// /// Logs an error in the console /// Message to log /// public static void LogError(object message) => Debug.unityLogger.LogError(k_Tag, message); /// /// Logs an exception in the console /// Exception to log /// public static void LogException(Exception exception) => Debug.unityLogger.Log(LogType.Exception, k_Tag, exception); /// /// Logs an assertion in the console (only available when the define is enabled) /// Message to log /// [Conditional(k_UnityAssertions)] public static void LogAssertion(object message) => Debug.unityLogger.Log(LogType.Assert, k_Tag, message); /// /// Logs a verbose log in the console if verbose logging is activated /// Message to log /// #if !ENABLE_UNITY_SERVICES_VERBOSE_LOGGING [Conditional(k_VerboseLoggingDefine)] #endif public static void LogVerbose(object message) => Debug.unityLogger.Log(k_Tag, message); } }