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

CleanupInitializedFiles() public method

Removes records of initialized files that have not been accessed after the specified date.
Files are marked 'initialized' for the purpose of writing footers when the logging finishes.
public CleanupInitializedFiles ( System.DateTime cleanupThreshold ) : void
cleanupThreshold System.DateTime The cleanup threshold.
return void
        public void CleanupInitializedFiles(DateTime cleanupThreshold)
        {
            var filesToFinalize = new List<string>();

            // Select the files require to be finalized.
            foreach (var file in this.initializedFiles)
            {
                if (file.Value < cleanupThreshold)
                {
                    filesToFinalize.Add(file.Key);
                }
            }

            // Finalize the files.
            foreach (string fileName in filesToFinalize)
            {
                this.FinalizeFile(fileName);
            }
        }

Same methods

FileTarget::CleanupInitializedFiles ( ) : void