diff options
author | vnugent <public@vaughnnugent.com> | 2024-04-08 21:49:25 -0400 |
---|---|---|
committer | vnugent <public@vaughnnugent.com> | 2024-04-08 21:49:25 -0400 |
commit | 33c9fad14891914268d6ad6bb63c880b52b08860 (patch) | |
tree | abe9567c3dca94613ca4a3a911a8f0f37bb5a4d4 | |
parent | d8e1307252b176112040521f46951a02b5474c80 (diff) |
refactor: Change connection logging verbosity
-rw-r--r-- | plugins/ObjectCacheServer/src/Endpoints/ConnectEndpoint.cs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/plugins/ObjectCacheServer/src/Endpoints/ConnectEndpoint.cs b/plugins/ObjectCacheServer/src/Endpoints/ConnectEndpoint.cs index 42f406a..20d1836 100644 --- a/plugins/ObjectCacheServer/src/Endpoints/ConnectEndpoint.cs +++ b/plugins/ObjectCacheServer/src/Endpoints/ConnectEndpoint.cs @@ -25,6 +25,7 @@ using System; using System.Net; using System.Threading; +using System.Diagnostics; using System.Threading.Tasks; using System.Collections.Generic; @@ -224,7 +225,8 @@ namespace VNLib.Data.Caching.ObjectCache.Server.Endpoints MaxResponseBufferSize = (int)MemoryUtil.NearestPage(maxMessageSizeClamp), NodeId = nodeId, - Advertisment = discoveryAd + Advertisment = discoveryAd, + Address = entity.TrustedRemoteIp, }; } catch (KeyNotFoundException) @@ -243,8 +245,9 @@ namespace VNLib.Data.Caching.ObjectCache.Server.Endpoints private async Task WebsocketAcceptedAsync(WebSocketSession<WsUserState> wss) { WsUserState state = wss.UserState!; + Debug.Assert(state != null, "User state is null"); - Log.Debug("Client established websocket connection {sid}", wss.SocketID); + Log.Information("{sid} established websocket connection", state.Address); //Notify peers of new connection Peers.OnPeerConnected(state); @@ -309,7 +312,7 @@ namespace VNLib.Data.Caching.ObjectCache.Server.Endpoints //Notify monitor of disconnect Peers.OnPeerDisconnected(state); - Log.Debug("Client websocket disconnected {sid}", wss.SocketID); + Log.Information("{sid} websocket disconnected", state.Address); } @@ -321,6 +324,7 @@ namespace VNLib.Data.Caching.ObjectCache.Server.Endpoints public int MaxResponseBufferSize { get; init; } public string? NodeId { get; init; } public CacheNodeAdvertisment? Advertisment { get; init; } + public IPAddress Address { get; init; } public bool IsPeer => !string.IsNullOrWhiteSpace(NodeId); |