public void NLogTargetFlushesTelemetryClient()
        {
            var aiLogger = this.CreateTargetWithGivenInstrumentationKey();

            var       flushEvent     = new System.Threading.ManualResetEvent(false);
            Exception flushException = null;

            NLog.Common.AsyncContinuation asyncContinuation = (ex) => { flushException = ex; flushEvent.Set(); };
            aiLogger.Factory.Flush(asyncContinuation, 5000);
            Assert.IsTrue(flushEvent.WaitOne(5000));
            Assert.IsNotNull(flushException);
            Assert.AreEqual("Flush called", flushException.Message);
        }
Beispiel #2
0
 public void Flush(NLog.Common.AsyncContinuation asyncContinuation)
 {
     (_proxyTask ?? Task.CompletedTask).ContinueWith(task => asyncContinuation.Invoke(task.Exception));
 }
Beispiel #3
0
 public void Flush(NLog.Common.AsyncContinuation asyncContinuation)
 {
     asyncContinuation(null);
 }