Skip to content

Commit

Permalink
Merge branch 'master' into ib/port-operator-changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ibodrov authored Apr 29, 2024
2 parents 48a9b03 + 39203d1 commit 288ed3d
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public WebSocketListener(WebSocketChannelManager channelManager, UUID channelId,
this.channelManager = channelManager;
this.channelId = channelId;
this.agentId = agentId;
this.userAgent = userAgent;
this.userAgent = sanitize(userAgent);
}

@Override
Expand Down Expand Up @@ -82,6 +82,16 @@ public void onWebSocketConnect(Session session) {

@Override
public void onWebSocketError(Throwable cause) {
log.error("onWebSocketError ['{}'] -> error", channelId, cause);
log.warn("onWebSocketError ['{}', '{}'] -> error: {}", channelId, userAgent, cause.getMessage());
}

private static String sanitize(String log) {
if (log == null || log.isEmpty()) {
return log;
}
if (log.length() > 128) {
log = log.substring(0, 128) + "...cut";
}
return log.replace("\n", "\\n");
}
}

0 comments on commit 288ed3d

Please sign in to comment.