NLog.LogFactory.Flush C# (CSharp) Method

Flush() public method

Flush any pending log messages (in case of asynchronous targets).
public Flush ( AsyncContinuation asyncContinuation, int timeoutMilliseconds ) : void
asyncContinuation AsyncContinuation The asynchronous continuation.
timeoutMilliseconds int Maximum time to allow for the flush. Any messages after that time will be discarded.
return void
        public void Flush(AsyncContinuation asyncContinuation, int timeoutMilliseconds)
        {
            this.Flush(asyncContinuation, TimeSpan.FromMilliseconds(timeoutMilliseconds));
        }

Same methods

LogFactory::Flush ( ) : void
LogFactory::Flush ( AsyncContinuation asyncContinuation ) : void
LogFactory::Flush ( AsyncContinuation asyncContinuation, System.TimeSpan timeout ) : void
LogFactory::Flush ( System.TimeSpan timeout ) : void
LogFactory::Flush ( int timeoutMilliseconds ) : void

Usage Example

Example #1
0
 /// <summary>
 /// Flushes the output (if <see cref="DisableFlush"/> is not <c>true</c>) buffer with the default timeout of 15 seconds.
 /// </summary>
 public override void Flush()
 {
     if (!DisableFlush)
     {
         if (LogFactory != null)
         {
             LogFactory.Flush();
         }
         else
         {
             LogManager.Flush();
         }
     }
 }
All Usage Examples Of NLog.LogFactory::Flush