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;
}