Improve TopicClientExtensions logging

This commit is contained in:
Jordan Dominion
2024-07-12 14:49:25 -04:00
parent 3eb96f34d0
commit 3cf2cd7d20
@@ -16,6 +16,11 @@ namespace Tgstation.Server.Host.Extensions
/// </summary>
static class TopicClientExtensions
{
/// <summary>
/// Counter for topic request logging.
/// </summary>
static ulong topicRequestId;
/// <summary>
/// Send a <paramref name="queryString"/> with optional repeated priority.
/// </summary>
@@ -45,13 +50,14 @@ namespace Tgstation.Server.Host.Extensions
{
firstSend = false;
logger.LogTrace("Begin topic request");
var localRequestId = Interlocked.Increment(ref topicRequestId);
logger.LogTrace("Begin topic request #{requestId}: {query}", localRequestId, queryString);
var byondResponse = await topicClient.SendTopic(
endpoint,
queryString,
cancellationToken);
logger.LogTrace("End topic request");
logger.LogTrace("End topic request #{requestId}", localRequestId);
return byondResponse;
}
catch (Exception ex) when (ex is not OperationCanceledException)