2023-09-20 10:51:47 +02:00
|
|
|
|
using Logging;
|
|
|
|
|
|
|
|
|
|
|
|
namespace DistTestCore.Logs
|
2023-09-12 11:25:04 +02:00
|
|
|
|
{
|
2025-04-22 12:25:37 +02:00
|
|
|
|
public abstract class BaseTestLog : ILog
|
2023-09-12 11:25:04 +02:00
|
|
|
|
{
|
2025-04-22 12:25:37 +02:00
|
|
|
|
private readonly ILog backingLog;
|
2024-02-22 10:41:07 -03:00
|
|
|
|
|
2025-04-22 12:25:37 +02:00
|
|
|
|
protected BaseTestLog(ILog backingLog, string deployId)
|
2024-02-22 10:41:07 -03:00
|
|
|
|
{
|
2025-05-20 14:16:33 +02:00
|
|
|
|
this.backingLog = new TimestampPrefixer(backingLog);
|
2025-04-22 12:25:37 +02:00
|
|
|
|
|
|
|
|
|
|
DeployId = deployId;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public string DeployId { get; }
|
|
|
|
|
|
|
|
|
|
|
|
public void AddStringReplace(string from, string to)
|
|
|
|
|
|
{
|
|
|
|
|
|
backingLog.AddStringReplace(from, to);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public LogFile CreateSubfile(string addName, string ext = "log")
|
|
|
|
|
|
{
|
|
|
|
|
|
return backingLog.CreateSubfile(addName, ext);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void Debug(string message = "", int skipFrames = 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
backingLog.Debug(message, skipFrames);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void Error(string message)
|
|
|
|
|
|
{
|
|
|
|
|
|
backingLog.Error(message);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public string GetFullName()
|
|
|
|
|
|
{
|
|
|
|
|
|
return backingLog.GetFullName();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void Log(string message)
|
|
|
|
|
|
{
|
|
|
|
|
|
backingLog.Log(message);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void Raw(string message)
|
|
|
|
|
|
{
|
|
|
|
|
|
backingLog.Raw(message);
|
2024-02-22 10:41:07 -03:00
|
|
|
|
}
|
2023-09-12 11:25:04 +02:00
|
|
|
|
|
2023-09-20 10:51:47 +02:00
|
|
|
|
public void WriteLogTag()
|
|
|
|
|
|
{
|
|
|
|
|
|
var category = NameUtils.GetCategoryName();
|
|
|
|
|
|
var name = NameUtils.GetTestMethodName();
|
2025-04-22 12:25:37 +02:00
|
|
|
|
backingLog.Raw($"{DeployId} {category} {name}");
|
2023-09-20 10:51:47 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-04-22 12:25:37 +02:00
|
|
|
|
protected static ILog CreateMainLog(string fullName, string name)
|
2023-09-12 11:25:04 +02:00
|
|
|
|
{
|
2025-04-22 12:25:37 +02:00
|
|
|
|
return new LogSplitter(
|
2025-05-14 15:01:21 +02:00
|
|
|
|
new FileLog(fullName),
|
2025-04-22 12:25:37 +02:00
|
|
|
|
new ConsoleLog()
|
|
|
|
|
|
);
|
2023-09-12 11:25:04 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|