Clean up logging

This commit is contained in:
Michal Pikulski
2025-11-10 13:03:36 +01:00
parent c99aad49f3
commit 3ebbecc277
38 changed files with 234 additions and 300 deletions

View File

@@ -75,7 +75,7 @@ public class AppleAudioSource : ManagedBehaviour
}
else
{
Debug.Log("[AUDIOMANAGER] AppleAudioSource " + name + " was suppressed because something more important is playing");
Logging.Debug("[AUDIOMANAGER] AppleAudioSource " + name + " was suppressed because something more important is playing");
}
}
else

View File

@@ -5,6 +5,7 @@ using AppleHills.Core.Interfaces;
using System.Collections.Generic;
using AudioSourceEvents;
using System;
using Core;
using Core.Lifecycle;
public class AudioManager : ManagedBehaviour, IPausable
@@ -71,16 +72,14 @@ public class AudioManager : ManagedBehaviour, IPausable
}
else
{
Debug.LogWarning("[AudioManager] QuickAccess.Instance is null during OnManagedAwake. Some audio references may remain unset.");
Logging.Warning("[AudioManager] QuickAccess.Instance is null during OnManagedAwake. Some audio references may remain unset.");
}
// Diagnostic
foreach (AppleAudioSource _audioSource in criticalVOSources)
{
Debug.Log("Found source: " + _audioSource.name);
Logging.Debug("Found source: " + _audioSource.name);
}
Debug.Log("[AudioManager] OnManagedAwake completed");
}
public void SetAudioPauseBehavior(PauseBehavior newPauseBehavior)
@@ -104,15 +103,15 @@ public class AudioManager : ManagedBehaviour, IPausable
public LevelAudioObject GetCurrentLevelAudioObject()
{
Debug.Log("Audio objects: " + FindObjectsByType<LevelAudioObject>(FindObjectsInactive.Include, FindObjectsSortMode.None).Length);
Logging.Debug("Audio objects: " + FindObjectsByType<LevelAudioObject>(FindObjectsInactive.Include, FindObjectsSortMode.None).Length);
if (FindObjectsByType<LevelAudioObject>(FindObjectsInactive.Include, FindObjectsSortMode.None).Length > 1)
{
Debug.LogWarning("Warning! More than one LevelAudioObject in the level! Using the first one found");
Logging.Warning("Warning! More than one LevelAudioObject in the level! Using the first one found");
return FindObjectsByType<LevelAudioObject>(FindObjectsInactive.Include, FindObjectsSortMode.None)[0];
}
if (FindObjectsByType<LevelAudioObject>(FindObjectsInactive.Include, FindObjectsSortMode.None).Length == 0)
{
Debug.LogWarning("Error! No LevelAudioObject found, AudioManager might not function properly!");
Logging.Warning("Error! No LevelAudioObject found, AudioManager might not function properly!");
return null;
}
else
@@ -158,12 +157,10 @@ public class AudioManager : ManagedBehaviour, IPausable
/// </summary>
public bool RequestPlayVO(AppleAudioSource requestedAudioSource)
{
//Debug.Log($"[AUDIOMANAGER] CurrentVO source prio: {currentlyPlayingVO.sourcePriority}, clip prio: {currentlyPlayingVO.clipPriority} requested VO prio: {requestedAudioSource.sourcePriority}, clip prio: {clipPriority}");
// If nothing is playing, let the requested audio source play
if (currentlyPlayingVO == null)
{
SetupNewAudioSource(requestedAudioSource);
Debug.Log($"[AUDIOMANAGER] Playing {currentlyPlayingVO.name} as nothing is currently playing.");
return true;
}
@@ -177,7 +174,6 @@ public class AudioManager : ManagedBehaviour, IPausable
{
InterruptAudioSource(requestedAudioSource);
SetupNewAudioSource(requestedAudioSource);
Debug.Log($"[AUDIOMANAGER] {currentlyPlayingVO.name} is the same as {requestedAudioSource.name}. Triggering it again.");
return true;
}
@@ -187,7 +183,6 @@ public class AudioManager : ManagedBehaviour, IPausable
InterruptAudioSource(requestedAudioSource);
SetupNewAudioSource(requestedAudioSource);
Debug.Log($"[AUDIOMANAGER] {currentlyPlayingVO.name} is not critical. Playing {requestedAudioSource.name} instead because it is critical.");
return true;
}
// If the requested audio source has the same priority as currently playing source, check the priority of the requested clip
@@ -197,8 +192,6 @@ public class AudioManager : ManagedBehaviour, IPausable
{
InterruptAudioSource(requestedAudioSource);
SetupNewAudioSource(requestedAudioSource);
Debug.Log($"[AUDIOMANAGER] Interrupted {currentlyPlayingVO.name} because it has same priority as {requestedAudioSource.name} but the requested clip has higher priority");
return true;
}
else
@@ -210,7 +203,6 @@ public class AudioManager : ManagedBehaviour, IPausable
if (currentlyPlayingVO.audioSourceType == AppleAudioSource.AudioSourceType.CriticalVO && currentlyPlayingVO.sourcePriority > requestedAudioSource.sourcePriority)
{
currentlyPlayingVO.InterruptAudio(requestedAudioSource.name);
Debug.Log($"[AUDIOMANAGER] Interrupted {currentlyPlayingVO.name} because {requestedAudioSource.name} has higher priority");
InterruptAudioSource(requestedAudioSource);
SetupNewAudioSource(requestedAudioSource);
return true;
@@ -218,7 +210,6 @@ public class AudioManager : ManagedBehaviour, IPausable
// If the requested audio source didn't clear any of the above cases, tell it to get rekt.
else
{
Debug.Log($"[AUDIOMANAGER] {currentlyPlayingVO.name} is still playing. {requestedAudioSource.name} has lower priority");
return false;
}
}
@@ -232,7 +223,6 @@ public class AudioManager : ManagedBehaviour, IPausable
{
if (audioSource.audioSource.resource == null)
{
Debug.Log($"[AUDIOMANAGER] Faled to setup {audioSource.name}. Invalid resource");
}
else
{

View File

@@ -1,6 +1,7 @@
using UnityEngine;
using UnityEngine.Audio;
using System;
using Core;
using Core.Lifecycle;
[Serializable]
@@ -50,7 +51,7 @@ public class LevelAudioObject : ManagedBehaviour
}
catch (Exception e)
{
Debug.LogWarning($"[LevelAudioObject] Failed to restore audio state: {e.Message}");
Logging.Warning($"[LevelAudioObject] Failed to restore audio state: {e.Message}");
}
}
@@ -68,7 +69,7 @@ public class LevelAudioObject : ManagedBehaviour
{
if (narratorAudioSource == null || firstNarration == null)
{
Debug.LogWarning($"[LevelAudioObject] Missing audio source or narration resource on {gameObject.name}");
Logging.Warning($"[LevelAudioObject] Missing audio source or narration resource on {gameObject.name}");
return;
}

View File

@@ -1,3 +1,4 @@
using Core;
using UnityEngine;
public class ProximitySoundReaction : MonoBehaviour
@@ -12,13 +13,13 @@ public class ProximitySoundReaction : MonoBehaviour
private void OnCollisionEnter2D(Collision2D collision)
{
Debug.Log("overlap!");
Logging.Debug("overlap!");
}
private void OnTriggerEnter2D(Collider2D collision)
{
Debug.Log("Wolter triggered!");
Logging.Debug("Wolter triggered!");
}