Skip to content

Commit 00d5a9d

Browse files
committed
Add more debug logs
1 parent 01ae4ce commit 00d5a9d

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

core/src/main/java/dev/faststats/SimpleFeatureFlagService.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ private <T> CompletableFuture<T> sendOptRequest(final SimpleFeatureFlag<T> flag,
8888

8989
return httpClient.sendAsync(request, HttpResponse.BodyHandlers.ofString()).thenCompose(response -> {
9090
if (response.statusCode() < 200 || response.statusCode() >= 300) {
91-
logger.error("Feature flag opt request failed with status %s", null, response.statusCode());
91+
logger.error("Feature flag opt request failed with status %s (%s)", null, response.statusCode(), response.body());
9292
return CompletableFuture.failedFuture(new IllegalStateException(
93-
"Feature flag opt request failed with status " + response.statusCode()
93+
"Feature flag opt request failed with status %s (%s)".formatted(response.statusCode(), response.body())
9494
));
9595
}
9696
return fetch(flag);
@@ -115,6 +115,7 @@ private <T> CompletableFuture<T> createFetch(final SimpleFeatureFlag<T> flag) {
115115
.uri(url.resolve("/v1/check"))
116116
.build();
117117

118+
logger.info("Fetching %s: %s", request.uri(), requestBody.toString());
118119
return httpClient.sendAsync(request, HttpResponse.BodyHandlers.ofString()).thenApply(response -> {
119120
try {
120121
final var body = JsonParser.parseString(response.body());
@@ -125,6 +126,7 @@ private <T> CompletableFuture<T> createFetch(final SimpleFeatureFlag<T> flag) {
125126
}
126127

127128
final var value = getValue(flag, body);
129+
logger.info("Fetch returned body: %s (value: %s)", body, value);
128130
flag.setLastFetch(System.currentTimeMillis());
129131
flag.setValue(value);
130132
return value;

0 commit comments

Comments
 (0)