public override async Task WriteMessagesAsync(IEnumerable <LogMessage> messages, CancellationToken token) { var message = new EventBusLoggerMessage { Messages = messages.ToArray(), Date = DateTime.Now, Source = Source }; try { Console.WriteLine("EventBusLoggerProvider: sending message to " + QueueUrl); await EventBus.Queue(QueueUrl).Publish(message); Console.WriteLine("EventBusLoggerProvider: sent message to " + QueueUrl); } catch (Exception ex) { IsEnabled = false; Console.WriteLine("Fatal error: Failed to publish the logs to the event bus."); Console.WriteLine(ex.ToFullMessage()); Console.WriteLine("\n\n"); foreach (var msg in messages) { Console.WriteLine(msg.Message + "\n" + msg.Stack + "\n----------\n"); } } }
public override async Task WriteMessagesAsync(IEnumerable <LogMessage> messages, CancellationToken token) { var message = new EventBusLoggerMessage { Messages = messages.ToArray(), Date = DateTime.Now, Source = Source }; try { await EventBus.Queue(QueueUrl).Publish(message); } catch (Exception ex) { IsEnabled = false; Console.WriteLine("Fatal error: Failed to publish the logs to the event bus."); Console.WriteLine(ex.ToFullMessage()); } }