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

GetPotentialFileForArchiving() private method

Returns the correct filename to archive
private GetPotentialFileForArchiving ( string fileName ) : string
fileName string
return string
        private string GetPotentialFileForArchiving(string fileName)
        {
            if (fileName == previousLogFileName)
            {
                //both the same, so don't care
                return fileName;
            }

            if (string.IsNullOrEmpty(previousLogFileName))
            {
                return fileName;
            }

            if (string.IsNullOrEmpty(fileName))
            {
                return previousLogFileName;
            }

            //this is an expensive call
            var fileLength = this.fileAppenderCache.GetFileLength(fileName, true);
            string fileToArchive = fileLength != null ? fileName : previousLogFileName;
            return fileToArchive;
        }