LogFileConcatenator.cs cleaned
This commit is contained in:
parent
2513187d89
commit
26b72e24da
|
|
@ -4,17 +4,17 @@ namespace InnovEnergy.App.SodiStoreMax;
|
||||||
|
|
||||||
public class LogFileConcatenator
|
public class LogFileConcatenator
|
||||||
{
|
{
|
||||||
private readonly string _logDirectory;
|
private readonly String _LogDirectory;
|
||||||
|
|
||||||
public LogFileConcatenator(String logDirectory = "JsonLogDirectory/")
|
public LogFileConcatenator(String logDirectory = "JsonLogDirectory/")
|
||||||
{
|
{
|
||||||
_logDirectory = logDirectory;
|
_LogDirectory = logDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String ConcatenateFiles(int numberOfFiles)
|
public String ConcatenateFiles(int numberOfFiles)
|
||||||
{
|
{
|
||||||
var logFiles = Directory
|
var logFiles = Directory
|
||||||
.GetFiles(_logDirectory, "log_*.json")
|
.GetFiles(_LogDirectory, "log_*.json")
|
||||||
.OrderByDescending(file => file)
|
.OrderByDescending(file => file)
|
||||||
.Take(numberOfFiles)
|
.Take(numberOfFiles)
|
||||||
.OrderBy(file => file)
|
.OrderBy(file => file)
|
||||||
|
|
@ -25,7 +25,6 @@ public class LogFileConcatenator
|
||||||
foreach (var fileContent in logFiles.Select(File.ReadAllText))
|
foreach (var fileContent in logFiles.Select(File.ReadAllText))
|
||||||
{
|
{
|
||||||
concatenatedContent.AppendLine(fileContent);
|
concatenatedContent.AppendLine(fileContent);
|
||||||
//concatenatedContent.AppendLine(); // Append an empty line to separate the files // maybe we don't need this
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return concatenatedContent.ToString();
|
return concatenatedContent.ToString();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue