/// <summary> /// Emit a batch of log events, running asynchronously. /// </summary> /// <param name="events">The events to emit.</param> /// <remarks>Override either <see cref="PeriodicBatchingSink.EmitBatch"/> or <see cref="PeriodicBatchingSink.EmitBatchAsync"/>, /// not both.</remarks> protected override void EmitBatch(IEnumerable <Events.LogEvent> events) { // This sink doesn't use batching to send events, instead only using // PeriodicBatchingSink to manage the worker thread; requires some consideration. foreach (var logEvent in events) { var renderedLogEvent = new LogEvent(logEvent, logEvent.RenderMessage(_formatProvider)); if (_groupNames != null && _groupNames != Array.Empty <string>()) { _context.Clients.Groups(_groupNames).ReceiveLogEvent(renderedLogEvent); } else if (_userIds != null && _userIds != Array.Empty <string>()) { _context.Clients.Users(_userIds).ReceiveLogEvent(renderedLogEvent); } else { _context.Clients.AllExcept(_excludedConnectionIds).ReceiveLogEvent(renderedLogEvent); } } }
public void broadcastLogEvent(Serilog.Sinks.SignalR.Data.LogEvent log) { Clients.All.broadcastLogEvent(log); }