Skip to content

Commit 7d03b41

Browse files
refactor: Logging update (#4002)
Update RigidbodyContactEventManager to use new logging system
1 parent 0a56f44 commit 7d03b41

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

com.unity.netcode.gameobjects/Runtime/Components/RigidbodyContactEventManager.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Collections.Generic;
33
using Unity.Collections;
44
using Unity.Jobs;
5+
using Unity.Netcode.Logging;
56
using Unity.Netcode.Runtime;
67
using UnityEngine;
78

@@ -105,14 +106,16 @@ private struct JobResultStruct
105106
private readonly Dictionary<int, ContactEventHandlerInfo> m_HandlerInfo = new Dictionary<int, ContactEventHandlerInfo>();
106107
#endif
107108

109+
private ContextualLogger m_Log;
108110
private void OnEnable()
109111
{
112+
m_Log = new ContextualLogger(this);
110113
m_ResultsArray = new NativeArray<JobResultStruct>(16, Allocator.Persistent);
111114
Physics.ContactEvent += Physics_ContactEvent;
112115
if (Instance != null)
113116
{
114-
NetworkLog.LogError($"[Invalid][Multiple Instances] Found more than one instance of {nameof(RigidbodyContactEventManager)}: {name} and {Instance.name}");
115-
NetworkLog.LogError($"[Disable][Additional Instance] Disabling {name} instance!");
117+
m_Log.Error(new Context(LogLevel.Error, $"Found more than one instance of {nameof(RigidbodyContactEventManager)}").AddTag("Invalid").AddTag("Multiple Instances").AddInfo("Instance 1", Instance.name).AddInfo("Instance 2", name));
118+
m_Log.Error(new Context(LogLevel.Error, $"Disabling instance: ").AddTag("Disable").AddTag("Additional Instance").AddInfo("Instance", name));
116119
gameObject.SetActive(false);
117120
return;
118121
}

0 commit comments

Comments
 (0)