protected override void FlushAsync(global::NLog.Common.AsyncContinuation asyncContinuation)
        {
            if (asyncContinuation == null)
            {
                throw new ArgumentNullException("asyncContinuation");
            }

            try
            {
                var task = this.flushBufferTask;
                if (task != null)
                {
                    task.FlushAndSend();
                }

                asyncContinuation(null);
            }
            catch (Exception ex)
            {
                asyncContinuation(ex);
            }
        }
Exemplo n.º 2
0
        protected override void FlushAsync(global::NLog.Common.AsyncContinuation asyncContinuation)
        {
            if (asyncContinuation == null)
            {
                throw new ArgumentNullException("asyncContinuation");
            }

            try
            {
                var task = this.flushBufferTask;
                if (task != null)
                {
                    // i don't love this, but it maintains parity w/ existing sync calls
                    task.FlushAndSend().GetAwaiter().GetResult();
                }

                asyncContinuation(null);
            }
            catch (Exception ex)
            {
                asyncContinuation(ex);
            }
        }