2
0
mirror of synced 2025-01-20 21:39:10 +00:00
2024-09-12 15:03:06 +02:00

64 lines
1.5 KiB
C#

using Logging;
namespace AutoClient
{
public class Performance
{
private readonly ILog log;
public Performance(ILog log)
{
this.log = log;
}
public void DownloadFailed(Exception ex)
{
Log($"Download failed: {ex}");
}
public void DownloadSuccessful(long size, TimeSpan time)
{
long seconds = Convert.ToInt64(time.TotalSeconds);
long bytesPerSecond = size / seconds;
Log($"Download successful: {bytesPerSecond} bytes per second");
}
public void StorageContractCancelled()
{
Log("Contract cancelled");
}
public void StorageContractErrored(string error)
{
Log($"Contract errored: {error}");
}
public void StorageContractFinished()
{
Log("Contract finished");
}
public void StorageContractStarted()
{
Log("Contract started");
}
public void UploadFailed(Exception ex)
{
Log($"Upload failed: {ex}");
}
public void UploadSuccessful(long size, TimeSpan time)
{
long seconds = Convert.ToInt64(time.TotalSeconds);
long bytesPerSecond = size / seconds;
Log($"Upload successful: {bytesPerSecond} bytes per second");
}
private void Log(string msg)
{
log.Log(msg);
}
}
}