From 21ac51a518c64d44892aa550166de1f9a03a4d45 Mon Sep 17 00:00:00 2001 From: Max Heimbrock <43608204+MaxHeimbrock@users.noreply.github.com> Date: Tue, 9 Jun 2026 16:06:35 +0200 Subject: [PATCH] Use Utils logging helpers instead of raw Debug.Log in SDK runtime Replace the four remaining UnityEngine.Debug.Log* calls in the runtime with the SDK's Utils logging helpers so they follow the established convention (LK_DEBUG-gated, "LiveKit"-prefixed): - RtcAudioSource / RtcVideoSource / Rpc: Utils.Debug (compiled out unless LK_DEBUG is defined; RPC errors are often normal app-level results) - TokenSourceComponent: Utils.Warning (developer misconfiguration that should stay visible in all builds) Adds the LiveKit.Internal using to Rpc and TokenSourceComponent, and drops the now-unused UnityEngine using from Rpc. Co-Authored-By: Claude Opus 4.8 (1M context) --- Runtime/Scripts/Rpc.cs | 4 ++-- Runtime/Scripts/RtcAudioSource.cs | 2 +- Runtime/Scripts/RtcVideoSource.cs | 2 +- Runtime/Scripts/TokenSource/TokenSourceComponent.cs | 3 ++- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Runtime/Scripts/Rpc.cs b/Runtime/Scripts/Rpc.cs index e69d55fb..b23ca8dc 100644 --- a/Runtime/Scripts/Rpc.cs +++ b/Runtime/Scripts/Rpc.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using UnityEngine; +using LiveKit.Internal; namespace LiveKit { @@ -90,7 +90,7 @@ public RpcError(uint code, string message, string rpcData = null) : base(message internal static RpcError FromProto(Proto.RpcError proto) { - Debug.Log($"RPC error received: {proto.Code} {proto.Message} {proto.Data}"); + Utils.Debug($"RPC error received: {proto.Code} {proto.Message} {proto.Data}"); return new RpcError(proto.Code, proto.Message, proto.Data); } diff --git a/Runtime/Scripts/RtcAudioSource.cs b/Runtime/Scripts/RtcAudioSource.cs index dcbfb58f..a9af8a0a 100644 --- a/Runtime/Scripts/RtcAudioSource.cs +++ b/Runtime/Scripts/RtcAudioSource.cs @@ -96,7 +96,7 @@ protected RtcAudioSource(int channels = 2, RtcAudioSourceType audioSourceType = DefaultMicrophoneSampleRate : DefaultSampleRate; _expectedSampleRate = newAudioSource.SampleRate; - UnityEngine.Debug.Log($"NewAudioSource: {newAudioSource.NumChannels} {newAudioSource.SampleRate}"); + Utils.Debug($"NewAudioSource: {newAudioSource.NumChannels} {newAudioSource.SampleRate}"); newAudioSource.Options = request.TempResource(); newAudioSource.Options.EchoCancellation = true; diff --git a/Runtime/Scripts/RtcVideoSource.cs b/Runtime/Scripts/RtcVideoSource.cs index 1ef072d2..dab63255 100644 --- a/Runtime/Scripts/RtcVideoSource.cs +++ b/Runtime/Scripts/RtcVideoSource.cs @@ -216,7 +216,7 @@ protected virtual void Dispose(bool disposing) UnityEngine.Object.Destroy(_previewTexture); if (_captureBuffer.IsCreated) { - Debug.Log("Disposing capture buffer"); + Utils.Debug("Disposing capture buffer"); _captureBuffer.Dispose(); } Handle?.Dispose(); diff --git a/Runtime/Scripts/TokenSource/TokenSourceComponent.cs b/Runtime/Scripts/TokenSource/TokenSourceComponent.cs index dc438356..e0b3cdec 100644 --- a/Runtime/Scripts/TokenSource/TokenSourceComponent.cs +++ b/Runtime/Scripts/TokenSource/TokenSourceComponent.cs @@ -3,6 +3,7 @@ using System.Linq; using System.Threading.Tasks; using UnityEngine; +using LiveKit.Internal; namespace LiveKit { @@ -67,7 +68,7 @@ public TaskYieldInstruction FetchConnectionDetails(TokenSourc case ITokenSourceFixed fixedSource: if (options != null) - Debug.LogWarning("TokenSourceComponent uses a fixed config, so fetch options are ignored."); + Utils.Warning("TokenSourceComponent uses a fixed config, so fetch options are ignored."); task = fixedSource.FetchConnectionDetails(); break;