mirror of
https://github.com/SoPat712/allstarr.git
synced 2026-02-09 23:55:10 -05:00
Add logging for server-to-client WebSocket messages to debug remote control
Some checks failed
CI / build-and-test (push) Has been cancelled
Some checks failed
CI / build-and-test (push) Has been cancelled
This commit is contained in:
@@ -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}",
|
||||||
|
|||||||
Reference in New Issue
Block a user