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

GetArchiveDateFormatString() private method

Gets the correct formatting to be used based on the value of for converting values which will be inserting into file names during archiving. This value will be computed only when a empty value or is passed into defaultFormat
private GetArchiveDateFormatString ( string defaultFormat ) : string
defaultFormat string Date format to used irrespectively of value.
return string
        private string GetArchiveDateFormatString(string defaultFormat)
        {
            // If archiveDateFormat is not set in the config file, use a default 
            // date format string based on the archive period.
            string formatString = defaultFormat;
            if (string.IsNullOrEmpty(formatString))
            {
                switch (this.ArchiveEvery)
                {
                    case FileArchivePeriod.Year: formatString = "yyyy"; break;
                    case FileArchivePeriod.Month: formatString = "yyyyMM"; break;
                    default: formatString = "yyyyMMdd"; break;
                    case FileArchivePeriod.Hour: formatString = "yyyyMMddHH"; break;
                    case FileArchivePeriod.Minute: formatString = "yyyyMMddHHmm"; break;
                }
            }
            return formatString;
        }