Skip to content

Commit b96677e

Browse files
authored
feat: optimize replay match log (#570)
* feat: optimize replay match log * feat: optimize replay log format
1 parent a9e2d9d commit b96677e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

arex-instrumentation-api/src/main/java/io/arex/inst/runtime/match/ReplayMatcher.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,16 @@ private static void logMatchResult(MatchStrategyContext context) {
5050
Mocker matchedMocker = context.getMatchMocker();
5151
Mocker requestMocker = context.getRequestMocker();
5252

53-
String matchResult;
53+
StringBuilder matchResult = new StringBuilder(requestMocker.getCategoryType().getName());
54+
matchResult.append(":").append(requestMocker.getOperationName());
5455
if (matchedMocker != null) {
55-
matchResult = "match success";
56+
matchResult.append(" match success");
5657
} else {
57-
matchResult = StringUtil.format("match fail, reason: %s", context.getReason());
58+
matchResult.append(" match fail, reason: ").append(context.getReason());
5859
}
5960

6061
String message = StringUtil.format("%s %n%s, requestType: %s, match strategy: %s, mock strategy: %s",
61-
matchResult,
62+
matchResult.toString(),
6263
requestMocker.logBuilder().toString(),
6364
requestMocker.getTargetRequest().getType(),
6465
(context.getMatchStrategy() != null ? context.getMatchStrategy().name() : StringUtil.EMPTY),

0 commit comments

Comments
 (0)