Add logging for server-to-client WebSocket messages to debug remote control
Some checks failed
CI / build-and-test (push) Has been cancelled

This commit is contained in:
2026-02-04 11:30:12 -05:00
parent aadda9b873
commit e7ff330625

View File

@@ -235,8 +235,15 @@ public class WebSocketProxyMiddleware
{ {
var messageBytes = messageBuffer.ToArray(); var messageBytes = messageBuffer.ToArray();
// Log message for debugging (only in debug mode to avoid spam) // Log message for Server→Client direction to see remote control commands
if (_logger.IsEnabled(LogLevel.Debug)) if (direction == "Server→Client")
{
var messageText = System.Text.Encoding.UTF8.GetString(messageBytes);
_logger.LogInformation("📥 WEBSOCKET {Direction}: {Preview}",
direction,
messageText.Length > 500 ? messageText[..500] + "..." : messageText);
}
else if (_logger.IsEnabled(LogLevel.Debug))
{ {
var messageText = System.Text.Encoding.UTF8.GetString(messageBytes); var messageText = System.Text.Encoding.UTF8.GetString(messageBytes);
_logger.LogDebug("{Direction}: {MessageType} message ({Size} bytes): {Preview}", _logger.LogDebug("{Direction}: {MessageType} message ({Size} bytes): {Preview}",