69 lines
1.6 KiB
C#
Raw Permalink Normal View History

2023-09-20 10:51:47 +02:00
using Logging;
namespace DistTestCore.Logs
2023-09-12 11:25:04 +02:00
{
public abstract class BaseTestLog : ILog
2023-09-12 11:25:04 +02:00
{
private readonly ILog backingLog;
protected BaseTestLog(ILog backingLog, string deployId)
{
2025-05-20 14:16:33 +02:00
this.backingLog = new TimestampPrefixer(backingLog);
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);
}
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();
backingLog.Raw($"{DeployId} {category} {name}");
2023-09-20 10:51:47 +02:00
}
protected static ILog CreateMainLog(string fullName, string name)
2023-09-12 11:25:04 +02:00
{
return new LogSplitter(
2025-05-14 15:01:21 +02:00
new FileLog(fullName),
new ConsoleLog()
);
2023-09-12 11:25:04 +02:00
}
}
}