66namespace ozakboy . NLOG . Core
77{
88 /// <summary>
9- /// 異步日誌處理器,負責管理日誌的異步寫入操作
9+ /// 異步日誌處理器 - 負責管理日誌的異步寫入操作,提供高效能的日誌處理機制
10+ /// Asynchronous Log Handler - Manages asynchronous log writing operations, providing high-performance logging mechanism
1011 /// </summary>
1112 internal static class AsyncLogHandler
1213 {
1314 // 核心變數
1415 /// <summary>
15- /// 日誌隊列, 用於存儲待處理的日誌項目
16- /// 使用 ConcurrentQueue 確保線程安全的入隊和出隊操作
16+ /// 日誌隊列 - 用於存儲待處理的日誌項目
17+ /// Log Queue - Stores pending log items for processing
1718 /// </summary>
19+ /// <remarks>
20+ /// 使用 ConcurrentQueue 確保線程安全的入隊和出隊操作
21+ /// Uses ConcurrentQueue to ensure thread-safe enqueue and dequeue operations
22+ /// </remarks>
1823 private static readonly ConcurrentQueue < LogItem > _logQueue = new ConcurrentQueue < LogItem > ( ) ;
1924
2025 /// <summary>
21- /// 信號量,用於通知處理線程有新的日誌需要處理
26+ /// 信號量,用於通知處理執行緒有新的日誌需要處理
2227 /// 初始計數為0,每當有新日誌加入時會釋放一個信號
28+ /// Semaphore for notifying the processing thread of new logs
29+ /// Initial count is 0, releases a signal when new logs are added
2330 /// </summary>
31+
2432 private static readonly SemaphoreSlim _signal = new SemaphoreSlim ( 0 ) ;
2533
2634 /// <summary>
27- /// 取消令牌源,用於控制處理線程的生命週期
28- /// 當需要停止處理線程時,可以通過此令牌發出取消信號
35+ /// 取消權杖來源,用於控制處理程序的生命週期
36+ /// Cancellation token source for controlling the processor lifecycle
2937 /// </summary>
3038 private static readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource ( ) ;
3139
@@ -40,7 +48,8 @@ internal static class AsyncLogHandler
4048 private static bool _isInitialized ;
4149
4250 /// <summary>
43- /// 用於初始化同步的鎖對象
51+ /// 用於初始化同步的鎖定物件
52+ /// Lock object for initialization synchronization
4453 /// </summary>
4554 private static readonly object _lockObj = new object ( ) ;
4655
@@ -51,7 +60,8 @@ private static LogConfiguration.IAsyncLogOptions CurrentAsyncOptions
5160 => LogConfiguration . Current . AsyncOptions ;
5261
5362 /// <summary>
54- /// 上次寫入的時間
63+ /// 最後一次寫入的時間戳記
64+ /// Last write timestamp
5565 /// </summary>
5666 private static DateTime _lastFlushTime = DateTime . Now ;
5767
0 commit comments