public void Ship_SendLogsInDelay_CreatesNewThreadCorrectly() { var options = new ShipperOptions { BufferSize = 1, BulkSenderOptions = { ListenerUrl = _dummy.DefaultUrl } }; _shipper.Ship(GetLogging(), options); _shipper.Flush(options); _shipper.Ship(GetLogging(), options); _shipper.Flush(options); _dummy.Requests.Count.ShouldBe(2); }
public void Ship_BufferTimeoutReached_LogWasSent() { var options = new ShipperOptions { BufferSize = 10, BufferTimeLimit = TimeSpan.FromMilliseconds(50) }; _target.Ship(GetLoggingEventWithSomeData(), options); _target.Ship(GetLoggingEventWithSomeData(), options); _target.WaitForSendLogsTask(); _bulkSender.DidNotReceiveWithAnyArgs().SendAsync(Arg.Any <ICollection <LogzioLoggingEvent> >(), Arg.Any <BulkSenderOptions>()); Thread.Sleep(TimeSpan.FromMilliseconds(100)); //wait for the actual timeout // Measured timing based instability. Hard to reproduce. _bulkSender.Received().SendAsync(Arg.Is <ICollection <LogzioLoggingEvent> >(x => x.Count == 2), Arg.Any <BulkSenderOptions>()); }
public void Flush_FlushingTwice_DoesntSendEmpty() { var options = new ShipperOptions { BufferSize = 1 }; var count = 5; for (var i = 0; i < count; i++) { _target.Ship(GetLoggingEventWithSomeData(), options); } _target.Flush(options); _target.Flush(options); _target.WaitForSendLogsTask(); _bulkSender.ReceivedCalls().Should().HaveCount(count); }
public InternalLoggerLog4net(ShipperOptions shipperOptions, IInternalLogger internalLogger) { _shipperOptions = shipperOptions; _internalLogger = internalLogger; }