Skip to content

Commit

Permalink
🎨 Optimzed debug log output
Browse files Browse the repository at this point in the history
  • Loading branch information
MisakaTAT committed Feb 26, 2024
1 parent 8cf43aa commit 7a90fa0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class GroupMessageEvent extends MessageEvent {
private String avatar;

@JSONField(name = "real_message_type")
private String real_message_type;
private String realMessageType;

@JSONField(name = "is_binded_group_id")
private Boolean isBindedGroupId;
Expand Down
9 changes: 2 additions & 7 deletions src/main/java/com/mikuac/shiro/handler/WebSocketHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.mikuac.shiro.common.utils.CommonUtils;
import com.mikuac.shiro.core.Bot;
import com.mikuac.shiro.core.BotContainer;
import com.mikuac.shiro.core.BotFactory;
Expand Down Expand Up @@ -226,13 +227,7 @@ public void afterConnectionClosed(@NonNull WebSocketSession session, @NonNull Cl
protected void handleTextMessage(@NonNull WebSocketSession session, TextMessage message) {
long xSelfId = parseSelfId(session);
JSONObject result = JSON.parseObject(message.getPayload());


if (!message.getPayload().contains("base64://")) {
log.debug("[Event] {}", result.toJSONString());
} else {
log.debug("[Event] {}", result.toJSONString().replaceAll("base64://.*]", "base64]"));
}
log.debug("[Event] {}", CommonUtils.debugMsgDeleteBase64Content(result.toJSONString()));
// if resp contains echo field, this resp is action resp, else event resp.
if (result.containsKey(API_RESULT_KEY)) {
if (FAILED_STATUS.equals(result.get(RESULT_STATUS_KEY))) {
Expand Down

0 comments on commit 7a90fa0

Please sign in to comment.