/// <summary> /// Logging queue processing run function /// </summary> private async Task RunLogging(CancellationToken cancelToken) { try { while (!cancelToken.IsCancellationRequested) { await NotifyAddedLog.WaitAsync(cancelToken); List <LogEventArgs> allEvents = new List <LogEventArgs>(); while (!LogsQueue.IsEmpty) { if (LogsQueue.TryDequeue(out var nextLog)) { allEvents.AddRange(GenerateLogsForLogEvent(nextLog)); } } LoggedEvents?.Invoke(this, allEvents); LogToLog4(allEvents); } } catch (OperationCanceledException) { } catch (Exception e) { System.Diagnostics.Debug.WriteLine($"Exception in logging: {e}."); } }
/// <summary> /// Logging queue processing run function /// </summary> async Task RunLogging(CancellationToken cancelToken) { try { try { while (!cancelToken.IsCancellationRequested) { await NotifyAddedLog.WaitAsync(cancelToken); ProcessLogs(); } } catch (OperationCanceledException) { } catch (Exception e) { System.Diagnostics.Debug.WriteLine($"Exception in logging: {e}."); } } catch (Exception e) { System.Diagnostics.Debug.WriteLine($"Exception in logging: {e}."); } }