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

DeleteOldArchiveFile() private static method

private static DeleteOldArchiveFile ( string fileName ) : bool
fileName string
return bool
        private static bool DeleteOldArchiveFile(string fileName)
        {
            try
            {
                InternalLogger.Info("Deleting old archive file: '{0}'.", fileName);
                File.Delete(fileName);
                return true;
            }
            catch (DirectoryNotFoundException exception)
            {
                //never rethrow this, as this isn't an exceptional case.
                InternalLogger.Debug(exception, "Failed to delete old log file '{0}' as directory is missing.", fileName);
                return false;
            }
            catch (Exception exception)
            {
                InternalLogger.Warn(exception, "Failed to delete old archive file: '{0}'.", fileName);
                if (exception.MustBeRethrown())
                {
                    throw;
                }

                return false;
            }
        }