aboutsummaryrefslogtreecommitdiffstats
path: root/hosted-api
diff options
context:
space:
mode:
authorJon Marius Venstad <venstad@gmail.com>2019-09-16 11:39:31 +0200
committerJon Marius Venstad <venstad@gmail.com>2019-09-16 11:39:31 +0200
commit6db8c233ee263aeee6e554ecd48d37a87f2a7a56 (patch)
tree70c9af1bd79ac7828aab8793ea42304927d1004f /hosted-api
parentf1112fbe19617a6d422292cbe808b3b2268fed65 (diff)
Use separate setting for Vespa log levels in deploy mojo
Diffstat (limited to 'hosted-api')
-rw-r--r--hosted-api/src/main/java/ai/vespa/hosted/api/ControllerHttpClient.java7
-rw-r--r--hosted-api/src/main/java/ai/vespa/hosted/api/DeploymentLog.java30
2 files changed, 31 insertions, 6 deletions
diff --git a/hosted-api/src/main/java/ai/vespa/hosted/api/ControllerHttpClient.java b/hosted-api/src/main/java/ai/vespa/hosted/api/ControllerHttpClient.java
index 43864f5f9d6..52ccec76799 100644
--- a/hosted-api/src/main/java/ai/vespa/hosted/api/ControllerHttpClient.java
+++ b/hosted-api/src/main/java/ai/vespa/hosted/api/ControllerHttpClient.java
@@ -313,11 +313,12 @@ public abstract class ControllerHttpClient {
private static DeploymentLog toDeploymentLog(HttpResponse<byte[]> response) {
Inspector rootObject = toInspector(response);
List<DeploymentLog.Entry> entries = new ArrayList<>();
- rootObject.field("log").traverse((ObjectTraverser) (__, entryArray) ->
+ rootObject.field("log").traverse((ObjectTraverser) (step, entryArray) ->
entryArray.traverse((ArrayTraverser) (___, entryObject) -> {
entries.add(new DeploymentLog.Entry(Instant.ofEpochMilli(entryObject.field("at").asLong()),
- entryObject.field("type").asString(),
- entryObject.field("message").asString()));
+ DeploymentLog.Level.of(entryObject.field("type").asString()),
+ entryObject.field("message").asString(),
+ "copyVespaLogs".equals(step)));
}));
return new DeploymentLog(entries,
rootObject.field("active").asBool(),
diff --git a/hosted-api/src/main/java/ai/vespa/hosted/api/DeploymentLog.java b/hosted-api/src/main/java/ai/vespa/hosted/api/DeploymentLog.java
index a42072fffd8..ded82a8573d 100644
--- a/hosted-api/src/main/java/ai/vespa/hosted/api/DeploymentLog.java
+++ b/hosted-api/src/main/java/ai/vespa/hosted/api/DeploymentLog.java
@@ -46,20 +46,22 @@ public class DeploymentLog {
public static class Entry {
private final Instant at;
- private final String level;
+ private final Level level;
private final String message;
+ private final boolean isVespaLogEntry;
- public Entry(Instant at, String level, String message) {
+ public Entry(Instant at, Level level, String message, boolean isVespaLogEntry) {
this.at = at;
this.level = level;
this.message = message;
+ this.isVespaLogEntry = isVespaLogEntry;
}
public Instant at() {
return at;
}
- public String level() {
+ public Level level() {
return level;
}
@@ -67,6 +69,28 @@ public class DeploymentLog {
return message;
}
+ public boolean isVespaLogEntry() {
+ return isVespaLogEntry;
+ }
+
+ }
+
+
+ public enum Level {
+ error,
+ warning,
+ info,
+ debug;
+
+ public static Level of(String level) {
+ switch (level) {
+ case "error" : return error;
+ case "warning" : return warning;
+ case "info" : return info;
+ case "debug" : return debug;
+ default : return debug;
+ }
+ }
}