diff options
author | 2018-08-23 15:39:19 +0200 | |
---|---|---|
committer | 2018-08-29 09:16:23 +0200 | |
commit | 296599aa5977fb047d9d0619ec3e463c031b0b49 (patch) | |
tree | 293ddfd0375d7eac91415dad430cc06151ea4d43 /vid-app-common/src/main/java/org/onap/vid/utils/Logging.java | |
parent | dbdcc5f7b7f540e727b8a39093e4aae5ec4f9457 (diff) |
Using Generic client in SchedulerRestInterface
Change-Id: I69603792016a091037d8767bec0f3d25641af86e
Issue-ID: VID-270
Signed-off-by: koblosz <sandra.koblosz@nokia.com>
Diffstat (limited to 'vid-app-common/src/main/java/org/onap/vid/utils/Logging.java')
-rw-r--r-- | vid-app-common/src/main/java/org/onap/vid/utils/Logging.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/utils/Logging.java b/vid-app-common/src/main/java/org/onap/vid/utils/Logging.java index e0ee6fbf..3ac90588 100644 --- a/vid-app-common/src/main/java/org/onap/vid/utils/Logging.java +++ b/vid-app-common/src/main/java/org/onap/vid/utils/Logging.java @@ -5,6 +5,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.google.common.collect.ImmutableList; +import io.joshworks.restclient.http.HttpResponse; import org.apache.commons.lang3.StringUtils; import org.onap.vid.exceptions.GenericUncheckedException; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; @@ -101,6 +102,15 @@ public class Logging { } } + public static <T> void logResponse(final EELFLogger logger, final HttpMethod method, final String url, final HttpResponse<T> response) { + try { + logger.debug("Received {} {} Status: {} . Body: {}", method.name(), url, response.getStatus(), response.getBody()); + } + catch (ProcessingException | IllegalStateException e) { + logger.debug("Received {} {} Status: {} . Failed to read response", method.name(), url, response.getStatus()); + } + } + public static void logResponse(final EELFLogger logger, final HttpMethod method, final String url, final Response response) { logResponse(logger, method, url, response, String.class); } |