mirror of
https://github.com/logos-storage/logos-storage-nim-cs-dist-tests.git
synced 2026-01-02 13:33:07 +00:00
53 lines
1.3 KiB
C#
53 lines
1.3 KiB
C#
using Logging;
|
|
using Utils;
|
|
|
|
namespace CodexContractsPlugin.ChainMonitor
|
|
{
|
|
public class PeriodReport
|
|
{
|
|
public PeriodReport(ProofPeriod period, PeriodRequiredProof[] required, FunctionCallReport[] functionCalls)
|
|
{
|
|
Period = period;
|
|
Required = required;
|
|
FunctionCalls = functionCalls;
|
|
}
|
|
|
|
public ProofPeriod Period { get; }
|
|
public PeriodRequiredProof[] Required { get; }
|
|
public FunctionCallReport[] FunctionCalls { get; }
|
|
|
|
public void Log(ILog log)
|
|
{
|
|
log.Log($"Period report: {Period}");
|
|
foreach (var r in Required)
|
|
{
|
|
log.Log($" Required: {r.Describe()}");
|
|
}
|
|
log.Log(" - Calls:");
|
|
foreach (var f in FunctionCalls)
|
|
{
|
|
log.Log($" - {f.Describe()}");
|
|
}
|
|
}
|
|
}
|
|
|
|
public class FunctionCallReport
|
|
{
|
|
public FunctionCallReport(DateTime utc, string name, string payload)
|
|
{
|
|
Utc = utc;
|
|
Name = name;
|
|
Payload = payload;
|
|
}
|
|
|
|
public DateTime Utc { get; }
|
|
public string Name { get; }
|
|
public string Payload { get; }
|
|
|
|
public string Describe()
|
|
{
|
|
return $"[{Time.FormatTimestamp(Utc)}] {Name} = \"{Payload}\"";
|
|
}
|
|
}
|
|
}
|