public void AzureEventHubLogWriter_WriteBatch_WritesToEventHub() { var writer = new AzureEventHubLogWriter(ConnectionString, null); int itemsInBatch = 50; var batch = new List <LogEvent>(itemsInBatch); for (int cnt = 0; cnt < itemsInBatch; cnt++) { batch.Add(new LogEvent() { DateTime = DateTime.Now, EventName = "Test event " + cnt.ToString(), EventType = LogEventType.SystemEvent, Source = "Test Source", Properties = new Dictionary <string, object>() { { "Test Prop", "Test Value" } } }); } var sw = new System.Diagnostics.Stopwatch(); sw.Start(); writer.WriteBatch(batch); sw.Stop(); System.Diagnostics.Trace.WriteLine($"Writing {itemsInBatch} log events to event hub took {sw.Elapsed.ToString()}"); }
public void AzureEventHubLogWriter_WriteBatch_WritesOverSizedBatch() { var writer = new AzureEventHubLogWriter(ConnectionString, null, false); int itemsInBatch = 2; var batch = new List <LogEvent>(itemsInBatch); for (int cnt = 0; cnt < itemsInBatch; cnt++) { batch.Add(new LogEvent() { DateTime = DateTime.Now, EventName = new string('A', 250 * 1024), EventType = LogEventType.SystemEvent, Source = "Test Source", Properties = new Dictionary <string, object>() { { "Test Prop", "Test Value" } } }); } writer.WriteBatch(batch); }