#if !(UNITY_QNX) // Disable under unsupported platforms. /******************************************************************************* The content of this file includes portions of the proprietary AUDIOKINETIC Wwise Technology released in source code form as part of the game integration package. The content of this file may not be used without valid licenses to the AUDIOKINETIC Wwise Technology. Note that the use of the game engine is subject to the Unity(R) Terms of Service at https://unity3d.com/legal/terms-of-service License Usage Licensees holding valid licenses to the AUDIOKINETIC Wwise Technology may use this file in accordance with the end user license agreement provided with the software or, alternatively, in accordance with the terms contained in a written agreement between you and Audiokinetic Inc. Copyright (c) 2026 Audiokinetic Inc. *******************************************************************************/ namespace AK.Wwise.Unity.Logging { public class WwiseLogger { private const string WwiseUnityMessagePrefix = "WwiseUnity: "; private static WwiseLogger _msInstance; private WwiseLogger() { if (_msInstance == null) { _msInstance = this; } } /// /// Get the AkLogger singleton /// public static WwiseLogger Instance { get { return _msInstance ??= new WwiseLogger(); } } private LogLevel logLevel { get => WwiseLoggerSettings.Instance.LogLevel; } ~WwiseLogger() { if (_msInstance == this) { _msInstance = null; } } /// /// Log a WwiseUnity error message. /// /// Message to log public static void Error(string message) { Log(LogLevel.Error, message); } /// /// Log a WwiseUnity warning message. /// /// Message to log public static void Warning(string message) { Log(LogLevel.Warning, message); } /// /// Log a WwiseUnity message. /// /// Message to log public static void Log(string message) { Log(LogLevel.Log, message); } /// /// Log a WwiseUnity message. /// /// Message to log public static void Verbose(string message) { Log(LogLevel.Verbose, message); } /// /// Log a WwiseUnity very verbose message. /// /// Message to log public static void VeryVerbose(string message) { Log(LogLevel.VeryVerbose, message); } /// /// Log a formatted WwiseUnity error message. /// /// Formatting string /// Formatting arguments public static void ErrorFormat(string format, params object[] args) { LogFormat(LogLevel.Error, format, args); } /// /// Log a formatted WwiseUnity warning message. /// /// Formatting string /// Formatting arguments public static void WarningFormat(string format, params object[] args) { LogFormat(LogLevel.Warning, format, args); } /// /// Log a formatted WwiseUnity message. /// /// Formatting string /// Formatting arguments public static void LogFormat(string format, params object[] args) { LogFormat(LogLevel.Log, format, args); } /// /// Log a formatted WwiseUnity verbose message. /// /// Formatting string /// Formatting arguments public static void VerboseFormat(string format, params object[] args) { LogFormat(LogLevel.Verbose, format, args); } /// /// Log a formatted WwiseUnity very verbose message. /// /// Formatting string /// Formatting arguments public static void VeryVerboseFormat(string format, params object[] args) { LogFormat(LogLevel.VeryVerbose, format, args); } /// /// Log a WwiseUnity message. /// /// Log verbosity /// Message to log public static void Log(LogLevel logLevel, string message) { #if (DEVELOPMENT_BUILD || UNITY_EDITOR) || !WWISE_SILENCE_LOGS_IN_RELEASE if (Instance.logLevel >= logLevel) { switch (logLevel) { case LogLevel.None: break; case LogLevel.Error: UnityEngine.Debug.LogError(WwiseUnityMessagePrefix + "(ERROR) "+ message); break; case LogLevel.Warning: UnityEngine.Debug.LogWarning(WwiseUnityMessagePrefix + "(WARNING) "+ message); break; case LogLevel.Log: UnityEngine.Debug.Log(WwiseUnityMessagePrefix + "(LOG) "+ message); break; case LogLevel.Verbose: UnityEngine.Debug.Log(WwiseUnityMessagePrefix + "(VERBOSE) "+ message); break; case LogLevel.VeryVerbose: UnityEngine.Debug.Log(WwiseUnityMessagePrefix + "(VERYVERBOSE) "+ message); break; } } #endif } /// /// Log a formatted WwiseUnity message. /// /// Log verbosity /// Formatting string /// Formatting arguments public static void LogFormat(LogLevel logLevel, string format, params object[] args) { #if (DEVELOPMENT_BUILD || UNITY_EDITOR) || !WWISE_SILENCE_LOGS_IN_RELEASE if (Instance.logLevel >= logLevel) { switch (logLevel) { case LogLevel.None: break; case LogLevel.Error: UnityEngine.Debug.LogErrorFormat(WwiseUnityMessagePrefix + "(ERROR) "+ format, args); break; case LogLevel.Warning: UnityEngine.Debug.LogWarningFormat(WwiseUnityMessagePrefix + "(WARNING) "+ format, args); break; case LogLevel.Log: UnityEngine.Debug.LogFormat(WwiseUnityMessagePrefix + "(LOG) "+ format, args); break; case LogLevel.Verbose: UnityEngine.Debug.LogFormat(WwiseUnityMessagePrefix + "(VERBOSE) "+ format, args); break; case LogLevel.VeryVerbose: UnityEngine.Debug.LogFormat(WwiseUnityMessagePrefix + "(VERYVERBOSE) "+ format, args); break; } } #endif } } } #endif // #if !(UNITY_QNX) // Disable under unsupported platforms.