Skip to content

Commit

Permalink
More logging
Browse files Browse the repository at this point in the history
  • Loading branch information
dkovacevic committed Dec 7, 2023
1 parent 5380e09 commit a344e10
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions backend/src/main/java/com/wire/bots/roman/ProviderClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@
import jakarta.ws.rs.client.Client;
import jakarta.ws.rs.client.Entity;
import jakarta.ws.rs.client.WebTarget;
import jakarta.ws.rs.core.Cookie;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.NewCookie;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.*;
import org.glassfish.jersey.logging.LoggingFeature;

import java.io.ByteArrayOutputStream;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.UUID;
import java.util.logging.Level;

public class ProviderClient {
private final WebTarget servicesTarget;
Expand All @@ -30,6 +29,12 @@ public ProviderClient(Client jerseyClient, String apiHost) {
.path("provider");
servicesTarget = providerTarget
.path("services");

if (Logger.getLevel() == Level.FINE) {
Feature feature = new LoggingFeature(Logger.getLOGGER(), Level.FINE, null, null);
providerTarget.register(feature);
servicesTarget.register(feature);
}
}

public Response register(String name, String email) {
Expand Down Expand Up @@ -80,6 +85,7 @@ public Response enableService(NewCookie zprovider, UUID serviceId, String passwo
Logger.debug("enableService: PUT %s", connection.getUri());
return connection
.request(MediaType.APPLICATION_JSON)
.accept(MediaType.APPLICATION_JSON)
.cookie(zprovider)
.put(Entity.entity(updateService, MediaType.APPLICATION_JSON));
}
Expand Down

0 comments on commit a344e10

Please sign in to comment.