Cleanup DA
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
using System.Text;
|
||||
using System.IO.Compression;
|
||||
using System.IO;
|
||||
using System.Globalization;
|
||||
using System.Diagnostics;
|
||||
using MarketData.MarketDataModel;
|
||||
@@ -98,6 +97,7 @@ namespace MarketData.Utils
|
||||
{
|
||||
DateTime creationTime = File.GetCreationTime(logFile);
|
||||
int age = dateGenerator.DaysBetweenActual(currentDate, creationTime);
|
||||
MDTrace.WriteLine($"[ExpireLogs ]{logFile} is {age} {(age>1?"days":"day")} old");
|
||||
if(age>=expiryDays)
|
||||
{
|
||||
File.Delete(logFile);
|
||||
@@ -107,45 +107,6 @@ namespace MarketData.Utils
|
||||
}
|
||||
}
|
||||
|
||||
// public static void RemoveLogFiles(String strFolder=null)
|
||||
// {
|
||||
// if(null==strFolder)strFolder=Directory.GetCurrentDirectory();
|
||||
// String[] logFiles=Directory.GetFiles(strFolder);
|
||||
// if(null==logFiles || 0==logFiles.Length)return;
|
||||
// logFiles=logFiles.Where(x => x.EndsWith(".log",StringComparison.InvariantCultureIgnoreCase)).ToArray<String>();
|
||||
// if(null==logFiles || 0==logFiles.Length)return;
|
||||
// foreach(String logFile in logFiles)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Removing {0}",logFile));
|
||||
// File.Delete(logFile);
|
||||
// }
|
||||
// catch(Exception){;}
|
||||
// }
|
||||
// }
|
||||
|
||||
// public static void RemoveLogFilesExcept(String exceptFile,String strFolder=null)
|
||||
// {
|
||||
// if(null==strFolder)strFolder=Directory.GetCurrentDirectory();
|
||||
// String[] logFiles=Directory.GetFiles(strFolder,"*.log");
|
||||
// if(null==logFiles || 0==logFiles.Length)return;
|
||||
// logFiles=logFiles
|
||||
// .Where(x => x.EndsWith(".log",StringComparison.InvariantCultureIgnoreCase) &&
|
||||
// !x.EndsWith(exceptFile,StringComparison.InvariantCultureIgnoreCase)).ToArray<String>();
|
||||
|
||||
// if(null==logFiles || 0==logFiles.Length)return;
|
||||
// foreach(String logFile in logFiles)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Removing {0}",logFile));
|
||||
// File.Delete(logFile);
|
||||
// }
|
||||
// catch(Exception){;}
|
||||
// }
|
||||
// }
|
||||
|
||||
public static String Pad(string str, char filler, int length)
|
||||
{
|
||||
int stringLength = str.Length;
|
||||
|
||||
Reference in New Issue
Block a user