NLog.Targets.FileTarget.ProcessOnStartup C# (CSharp) Method

ProcessOnStartup() private method

Invokes the archiving and clean up of older archive file based on the values of and properties respectively.
private ProcessOnStartup ( string fileName, LogEventInfo logEvent ) : void
fileName string File name to be written.
logEvent LogEventInfo Log event that the instance is currently processing.
return void
        private void ProcessOnStartup(string fileName, LogEventInfo logEvent)
        {
            if (this.ArchiveOldFileOnStartup)
            {
                try
                {
                    this.DoAutoArchive(fileName, logEvent);
                }
                catch (Exception exception)
                {
                    InternalLogger.Warn(exception, "Unable to archive old log file '{0}'.", fileName);

                    if (exception.MustBeRethrown())
                    {
                        throw;
                    }
                }
            }

            if (this.DeleteOldFileOnStartup)
            {
                DeleteOldArchiveFile(fileName);
            }
        }