2023-08-10 08:58:18 +00:00
|
|
|
|
using Logging;
|
2023-04-18 11:22:41 +00:00
|
|
|
|
|
|
|
|
|
namespace DistTestCore
|
|
|
|
|
{
|
|
|
|
|
public class BaseStarter
|
|
|
|
|
{
|
|
|
|
|
protected readonly TestLifecycle lifecycle;
|
|
|
|
|
private Stopwatch? stopwatch;
|
|
|
|
|
|
2023-08-10 08:58:18 +00:00
|
|
|
|
public BaseStarter(TestLifecycle lifecycle)
|
2023-04-18 11:22:41 +00:00
|
|
|
|
{
|
|
|
|
|
this.lifecycle = lifecycle;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void LogStart(string msg)
|
|
|
|
|
{
|
|
|
|
|
Log(msg);
|
|
|
|
|
stopwatch = Stopwatch.Begin(lifecycle.Log, GetClassName());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void LogEnd(string msg)
|
|
|
|
|
{
|
|
|
|
|
stopwatch!.End(msg);
|
|
|
|
|
stopwatch = null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void Log(string msg)
|
|
|
|
|
{
|
2023-04-19 07:19:06 +00:00
|
|
|
|
lifecycle.Log.Log($"{GetClassName()} {msg}");
|
2023-04-18 11:22:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-06-01 13:20:21 +00:00
|
|
|
|
protected void Debug(string msg)
|
|
|
|
|
{
|
|
|
|
|
lifecycle.Log.Debug($"{GetClassName()} {msg}", 1);
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-18 11:22:41 +00:00
|
|
|
|
private string GetClassName()
|
|
|
|
|
{
|
2023-04-19 07:19:06 +00:00
|
|
|
|
return $"({GetType().Name})";
|
2023-04-18 11:22:41 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|