1414using System . Linq ;
1515
1616#if __EVENTTIMELINE_DEBUG || __EVENTTIMELINE_DEBUG_VERBOSE
17- using UnityEngine ;
17+ using UnityEventTimeline . Internal . Logger ;
1818#endif
1919
2020namespace UnityEventTimeline . Internal . EventQueue
@@ -180,7 +180,7 @@ public EventPriorityQueue(int capacity = DefaultCapacity)
180180 _heap = new List < T > ( capacity > 0 ? capacity : DefaultCapacity ) ;
181181
182182#if __EVENTTIMELINE_DEBUG_VERBOSE
183- Debug . Log ( $ "[EventPriorityQueue] Initialized with capacity: { capacity } , DefaultCapacity: { DefaultCapacity } " ) ;
183+ AsyncLogger . LogFormat ( "[EventPriorityQueue] Initialized with capacity: {0 }, DefaultCapacity: {1}" , capacity , DefaultCapacity ) ;
184184#endif
185185 }
186186
@@ -200,13 +200,13 @@ public bool TryPeek([NotNullWhen(true)] out T? item)
200200 {
201201 item = _heap [ 0 ] ;
202202#if __EVENTTIMELINE_DEBUG_VERBOSE
203- Debug . Log ( $ "[EventPriorityQueue] Peeked item of type { item . GetType ( ) . Name } " ) ;
203+ AsyncLogger . LogFormat ( "[EventPriorityQueue] Peeked item of type {0}" , item . GetType ( ) . Name ) ;
204204#endif
205205 return true ;
206206 }
207207
208208#if __EVENTTIMELINE_DEBUG
209- Debug . LogWarning ( "[EventPriorityQueue] TryPeek failed - queue is empty" ) ;
209+ AsyncLogger . LogWarning ( "[EventPriorityQueue] TryPeek failed - queue is empty" ) ;
210210#endif
211211 item = null ;
212212 return false ;
@@ -227,13 +227,13 @@ public void Enqueue(T item)
227227 {
228228#if __EVENTTIMELINE_DEBUG_VERBOSE
229229 var initialCount = _heap . Count ;
230- Debug . Log ( $ "[EventPriorityQueue] Enqueuing item of type { item . GetType ( ) . Name } . Current queue size: { initialCount } " ) ;
230+ AsyncLogger . LogFormat ( "[EventPriorityQueue] Enqueuing item of type {0 }. Current queue size: {1}" , item . GetType ( ) . Name , initialCount ) ;
231231#endif
232232 _heap . Add ( item ) ;
233233 HeapifyUp ( _heap . Count - 1 ) ;
234234
235235#if __EVENTTIMELINE_DEBUG_VERBOSE
236- Debug . Log ( $ "[EventPriorityQueue] Item enqueued successfully. New queue size: { _heap . Count } " ) ;
236+ AsyncLogger . LogFormat ( "[EventPriorityQueue] Item enqueued successfully. New queue size: {0}" , _heap . Count ) ;
237237#endif
238238 }
239239 }
@@ -252,7 +252,7 @@ public void EnqueueRange(IEnumerable<T> items)
252252 {
253253#if __EVENTTIMELINE_DEBUG_VERBOSE
254254 var initialCount = _heap . Count ;
255- Debug . Log ( $ "[EventPriorityQueue] Beginning bulk enqueue operation. Current queue size: { initialCount } " ) ;
255+ AsyncLogger . LogFormat ( "[EventPriorityQueue] Beginning bulk enqueue operation. Current queue size: {0}" , initialCount ) ;
256256#endif
257257 _heap . AddRange ( items ) ;
258258
@@ -264,7 +264,7 @@ public void EnqueueRange(IEnumerable<T> items)
264264
265265#if __EVENTTIMELINE_DEBUG_VERBOSE
266266 var itemsAdded = _heap . Count - initialCount ;
267- Debug . Log ( $ "[EventPriorityQueue] Bulk enqueue completed. Added { itemsAdded } items. New queue size: { _heap . Count } " ) ;
267+ AsyncLogger . LogFormat ( "[EventPriorityQueue] Bulk enqueue completed. Added {0 } items. New queue size: {1}" , itemsAdded , _heap . Count ) ;
268268#endif
269269 }
270270 }
@@ -284,7 +284,7 @@ public IEnumerable<T> DequeueRange(int count)
284284 if ( count <= 0 )
285285 {
286286#if __EVENTTIMELINE_DEBUG
287- Debug . LogWarning ( "[EventPriorityQueue] DequeueRange called with count <= 0, returning empty array" ) ;
287+ AsyncLogger . LogWarning ( "[EventPriorityQueue] DequeueRange called with count <= 0, returning empty array" ) ;
288288#endif
289289 return Array . Empty < T > ( ) ;
290290 }
@@ -294,7 +294,7 @@ public IEnumerable<T> DequeueRange(int count)
294294 {
295295#if __EVENTTIMELINE_DEBUG_VERBOSE
296296 var initialCount = _heap . Count ;
297- Debug . Log ( $ "[EventPriorityQueue] Beginning DequeueRange operation. Requested: { count } , Available: { initialCount } " ) ;
297+ AsyncLogger . LogFormat ( "[EventPriorityQueue] Beginning DequeueRange operation. Requested: {0 }, Available: {1}" , count , initialCount ) ;
298298#endif
299299
300300 var resultSize = Math . Min ( count , _heap . Count ) ;
@@ -304,7 +304,7 @@ public IEnumerable<T> DequeueRange(int count)
304304 if ( resultSize > _heap . Count / 2 )
305305 {
306306#if __EVENTTIMELINE_DEBUG_VERBOSE
307- Debug . Log ( $ "[EventPriorityQueue] Using bulk dequeue optimization for { resultSize } items") ;
307+ AsyncLogger . LogFormat ( "[EventPriorityQueue] Using bulk dequeue optimization for {0 } items" , resultSize ) ;
308308#endif
309309 result . AddRange ( _heap . OrderBy ( x => x ) ) ;
310310 _heap . Clear ( ) ;
@@ -318,7 +318,7 @@ public IEnumerable<T> DequeueRange(int count)
318318 }
319319
320320#if __EVENTTIMELINE_DEBUG_VERBOSE
321- Debug . Log ( $ "[EventPriorityQueue] DequeueRange completed. Dequeued: { result . Count } , Remaining: { _heap . Count } " ) ;
321+ AsyncLogger . LogFormat ( "[EventPriorityQueue] DequeueRange completed. Dequeued: {0 }, Remaining: {1}" , result . Count , _heap . Count ) ;
322322#endif
323323 }
324324
@@ -338,13 +338,13 @@ public void Clear()
338338 {
339339#if __EVENTTIMELINE_DEBUG_VERBOSE
340340 var clearedCount = _heap . Count ;
341- Debug . Log ( $ "[EventPriorityQueue] Clearing queue. Items to be cleared: { clearedCount } " ) ;
341+ AsyncLogger . LogFormat ( "[EventPriorityQueue] Clearing queue. Items to be cleared: {0}" , clearedCount ) ;
342342#endif
343343
344344 _heap . Clear ( ) ;
345345
346346#if __EVENTTIMELINE_DEBUG_VERBOSE
347- Debug . Log ( "[EventPriorityQueue] Queue cleared successfully" ) ;
347+ AsyncLogger . Log ( "[EventPriorityQueue] Queue cleared successfully" ) ;
348348#endif
349349 }
350350 }
@@ -362,13 +362,13 @@ public void TrimExcess()
362362 {
363363#if __EVENTTIMELINE_DEBUG_VERBOSE
364364 var initialCapacity = _heap . Capacity ;
365- Debug . Log ( $ "[EventPriorityQueue] Beginning TrimExcess. Current capacity: { initialCapacity } , Count: { _heap . Count } " ) ;
365+ AsyncLogger . LogFormat ( "[EventPriorityQueue] Beginning TrimExcess. Current capacity: {0 }, Count: {1}" , initialCapacity , _heap . Count ) ;
366366#endif
367367
368368 _heap . TrimExcess ( ) ;
369369
370370#if __EVENTTIMELINE_DEBUG_VERBOSE
371- Debug . Log ( $ "[EventPriorityQueue] TrimExcess completed. New capacity: { _heap . Capacity } " ) ;
371+ AsyncLogger . LogFormat ( "[EventPriorityQueue] TrimExcess completed. New capacity: {0}" , _heap . Capacity ) ;
372372#endif
373373 }
374374 }
@@ -388,7 +388,7 @@ public bool Contains(T item)
388388 {
389389 var contains = _heap . Contains ( item ) ;
390390#if __EVENTTIMELINE_DEBUG_VERBOSE
391- Debug . Log ( $ "[EventPriorityQueue] Contains check for item of type { item . GetType ( ) . Name } : { contains } " ) ;
391+ AsyncLogger . LogFormat ( "[EventPriorityQueue] Contains check for item of type {0}: {1}" , item . GetType ( ) . Name , contains ) ;
392392#endif
393393 return contains ;
394394 }
@@ -409,14 +409,14 @@ public bool TryRemove(T item)
409409 lock ( _heapLock )
410410 {
411411#if __EVENTTIMELINE_DEBUG_VERBOSE
412- Debug . Log ( $ "[EventPriorityQueue] Attempting to remove item of type { item . GetType ( ) . Name } " ) ;
412+ AsyncLogger . LogFormat ( "[EventPriorityQueue] Attempting to remove item of type {0}" , item . GetType ( ) . Name ) ;
413413#endif
414414
415415 var index = _heap . IndexOf ( item ) ;
416416 if ( index == - 1 )
417417 {
418418#if __EVENTTIMELINE_DEBUG
419- Debug . LogWarning ( "[EventPriorityQueue] Item not found in queue" ) ;
419+ AsyncLogger . LogWarning ( "[EventPriorityQueue] Item not found in queue" ) ;
420420#endif
421421 return false ;
422422 }
@@ -426,7 +426,7 @@ public bool TryRemove(T item)
426426 {
427427 _heap . RemoveAt ( index ) ;
428428#if __EVENTTIMELINE_DEBUG_VERBOSE
429- Debug . Log ( "[EventPriorityQueue] Removed last item in queue" ) ;
429+ AsyncLogger . Log ( "[EventPriorityQueue] Removed last item in queue" ) ;
430430#endif
431431 return true ;
432432 }
@@ -443,7 +443,7 @@ public bool TryRemove(T item)
443443 HeapifyDown ( index ) ;
444444
445445#if __EVENTTIMELINE_DEBUG_VERBOSE
446- Debug . Log ( $ "[EventPriorityQueue] Item removed successfully. New queue size: { _heap . Count } " ) ;
446+ AsyncLogger . LogFormat ( "[EventPriorityQueue] Item removed successfully. New queue size: {0}" , _heap . Count ) ;
447447#endif
448448
449449 return true ;
@@ -463,7 +463,7 @@ public bool TryRemove(T item)
463463 private T DequeueInternal ( )
464464 {
465465#if __EVENTTIMELINE_DEBUG_VERBOSE
466- Debug . Log ( "[EventPriorityQueue] Beginning internal dequeue operation" ) ;
466+ AsyncLogger . Log ( "[EventPriorityQueue] Beginning internal dequeue operation" ) ;
467467#endif
468468
469469 var result = _heap [ 0 ] ;
@@ -477,7 +477,7 @@ private T DequeueInternal()
477477 }
478478
479479#if __EVENTTIMELINE_DEBUG_VERBOSE
480- Debug . Log ( $ "[EventPriorityQueue] Internal dequeue completed. Dequeued item of type { result . GetType ( ) . Name } " ) ;
480+ AsyncLogger . LogFormat ( "[EventPriorityQueue] Internal dequeue completed. Dequeued item of type {0}" , result . GetType ( ) . Name ) ;
481481#endif
482482
483483 return result ;
@@ -496,7 +496,7 @@ private T DequeueInternal()
496496 private void HeapifyUp ( int index )
497497 {
498498#if __EVENTTIMELINE_DEBUG_VERBOSE
499- Debug . Log ( $ "[EventPriorityQueue] Beginning HeapifyUp from index { index } " ) ;
499+ AsyncLogger . LogFormat ( "[EventPriorityQueue] Beginning HeapifyUp from index {0}" , index ) ;
500500 var initialIndex = index ;
501501#endif
502502
@@ -521,7 +521,7 @@ private void HeapifyUp(int index)
521521#if __EVENTTIMELINE_DEBUG_VERBOSE
522522 if ( index != initialIndex )
523523 {
524- Debug . Log ( $ "[EventPriorityQueue] HeapifyUp moved item from index { initialIndex } to { index } " ) ;
524+ AsyncLogger . LogFormat ( "[EventPriorityQueue] HeapifyUp moved item from index {0 } to {1}" , initialIndex , index ) ;
525525 }
526526#endif
527527 }
@@ -540,7 +540,7 @@ private void HeapifyUp(int index)
540540 private void HeapifyDown ( int index )
541541 {
542542#if __EVENTTIMELINE_DEBUG_VERBOSE
543- Debug . Log ( $ "[EventPriorityQueue] Beginning HeapifyDown from index { index } " ) ;
543+ AsyncLogger . LogFormat ( "[EventPriorityQueue] Beginning HeapifyDown from index {0}" , index ) ;
544544 var initialIndex = index ;
545545 var swaps = 0 ;
546546#endif
@@ -583,7 +583,7 @@ private void HeapifyDown(int index)
583583#if __EVENTTIMELINE_DEBUG_VERBOSE
584584 if ( swaps > 0 )
585585 {
586- Debug . Log ( $ "[EventPriorityQueue] HeapifyDown moved item from index { initialIndex } to { index } with { swaps } swaps") ;
586+ AsyncLogger . LogFormat ( "[EventPriorityQueue] HeapifyDown moved item from index {0 } to {1 } with {2 } swaps" , initialIndex , index , swaps ) ;
587587 }
588588#endif
589589 }
0 commit comments