aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2022-11-21 18:50:22 -0600
committerJP Dillingham <jp@dillingham.me>2022-11-21 18:50:22 -0600
commitaaea2f91c1fbef91a0fe6c5350c79b9bac3175c3 (patch)
tree223b845faf68cf67122caca061319fc5f717c990
parenteea25af2573f5404c091112db29f1d0594e12b5e (diff)
downloadslskd-aaea2f91c1fbef91a0fe6c5350c79b9bac3175c3.tar.gz
log share information around uploads
-rw-r--r--src/slskd/Relay/RelayClient.cs11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/slskd/Relay/RelayClient.cs b/src/slskd/Relay/RelayClient.cs
index bc0d5d48..515d30ca 100644
--- a/src/slskd/Relay/RelayClient.cs
+++ b/src/slskd/Relay/RelayClient.cs
@@ -20,6 +20,7 @@ using Microsoft.Extensions.Options;
namespace slskd.Relay
{
using System;
+ using System.Diagnostics;
using System.IO;
using System.Net.Http;
using System.Threading;
@@ -254,7 +255,12 @@ namespace slskd.Relay
request.Headers.Add("X-API-Key", OptionsMonitor.CurrentValue.Relay.Controller.ApiKey);
request.Content = content;
- Log.Information("Beginning upload of shares");
+ var size = ((double)stream.Length).SizeSuffix();
+ var sw = new Stopwatch();
+ sw.Start();
+
+ Log.Information("Beginning upload of shares ({Size})", size);
+ Log.Debug("Shares: {Shares}", Shares.LocalHost.Shares.ToJson());
var response = await CreateHttpClient().SendAsync(request, cancellationToken);
if (!response.IsSuccessStatusCode)
@@ -262,7 +268,8 @@ namespace slskd.Relay
throw new RelayException($"Failed to upload shares to relay controller: {response.StatusCode}");
}
- Log.Information("Upload shares succeeded");
+ sw.Stop();
+ Log.Information("Upload of shares succeeded ({Size} in {Duration}ms)", size, sw.ElapsedMilliseconds);
}
finally
{