2024年6月11日发(作者:)

}

else

{

logArr = new string[] { logPath, logMergeContent };

(logArr);

}

Tuple val = default(Tuple);

ueue(out val);

}

foreach (string[] item in temp)

{

WriteText(item[0], item[1]);

}

}

}

, null

, nning);

();

}

public static void WriteLog(String preFile, String infoData)

{

WriteLog(, preFile, infoData);

}

public static void WriteLog(String customDirectory, String preFile, String infoData)

{

string logPath = GetLogPath(customDirectory, preFile);

string logContent = (, " ", infoData);

e(new Tuple(logPath, logContent));

();

}

private static string GetLogPath(String customDirectory, String preFile)

{

string newFilePath = ;

String logDir = OrEmpty(customDirectory) ? e(tDirectory, "logs") : customDirectory;

if (!(logDir))

{

Directory(logDir);

}

string extension = ".log";

string fileNameNotExt = (preFile, ng("yyyyMMdd"));

String fileName = (fileNameNotExt, extension);

string fileNamePattern = (fileNameNotExt, "(*)", extension);

List filePaths = es(logDir, fileNamePattern, ectoryOnly).ToList();

if ( > 0)

{

int fileMaxLen = (d => );

string lastFilePath = (d => == fileMaxLen).OrderByDescending(d => d).FirstOrDefault();

if (new FileInfo(lastFilePath).Length > 1 * 1024 * 1024 * 1024)

{

string no = new Regex(@"(?is)(?<=()(.*)(?=))").Match(eName(lastFilePath)).Value;

int tempno = 0;

bool parse = se(no, out tempno);

string formatno = ("({0})", parse ? (tempno + 1) : tempno);

string newFileName = (fileNameNotExt, formatno, extension);

newFilePath = e(logDir, newFileName);

}

else

{

newFilePath = lastFilePath;

}

}

else

{

string newFileName = (fileNameNotExt, ("({0})", 0), extension);

newFilePath = e(logDir, newFileName);

}

return newFilePath;

}

private static void WriteText(string logPath, string logContent)

{

try

{

if (!(logPath))

{

Text(logPath).Close();

}

StreamWriter sw = Text(logPath);

(logContent);

();

}

catch (Exception ex)

{

}

finally

{

}

}

}