cs-codex-dist-tests/DistTestCore/Logs/LogDownloadHandler.cs

36 lines
890 B
C#
Raw Normal View History

2023-04-13 09:30:19 +00:00
using KubernetesWorkflow;
using Logging;
2023-04-14 07:54:07 +00:00
namespace DistTestCore.Logs
2023-04-13 09:30:19 +00:00
{
public class LogDownloadHandler : ILogHandler
{
private readonly string description;
private readonly LogFile log;
public LogDownloadHandler(string description, LogFile log)
{
this.description = description;
this.log = log;
}
public CodexNodeLog CreateCodexNodeLog()
{
return new CodexNodeLog(log);
}
public void Log(Stream stream)
{
2023-04-14 12:53:39 +00:00
log.Write($"{description} -->> {log.FullFilename}");
2023-04-13 09:30:19 +00:00
log.WriteRaw(description);
var reader = new StreamReader(stream);
var line = reader.ReadLine();
while (line != null)
{
log.WriteRaw(line);
line = reader.ReadLine();
}
}
}
}