| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 599aeb7 commit a135d21
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -25,6 +25,8 @@ | |||
| 25 | 25 | * @param since | |
| 26 | 26 | * - UNIX timestamp (integer) to filter logs. Specifying a timestamp will only output log-entries since that timestamp. Default: | |
| 27 | 27 | * 0 (unfiltered) | |
| 28 | + * @param until | ||
| 29 | + * - Only return logs before this time, as a UNIX timestamp. Default: 0 | ||
| 28 | 30 | */ | |
| 29 | 31 | public interface LogContainerCmd extends AsyncDockerCmd<LogContainerCmd, Frame> { | |
| 30 | 32 | ||
@@ -49,6 +51,9 @@ public interface LogContainerCmd extends AsyncDockerCmd<LogContainerCmd, Frame> | |||
| 49 | 51 | @CheckForNull | |
| 50 | 52 | Integer getSince(); | |
| 51 | 53 | ||
| 54 | + @CheckForNull | ||
| 55 | + Integer getUntil(); | ||
| 56 | + | ||
| 52 | 57 | LogContainerCmd withContainerId(@Nonnull String containerId); | |
| 53 | 58 | ||
| 54 | 59 | /** | |
@@ -69,6 +74,8 @@ public interface LogContainerCmd extends AsyncDockerCmd<LogContainerCmd, Frame> | |||
| 69 | 74 | ||
| 70 | 75 | LogContainerCmd withSince(Integer since); | |
| 71 | 76 | ||
| 77 | + LogContainerCmd withUntil(Integer until); | ||
| 78 | + | ||
| 72 | 79 | /** | |
| 73 | 80 | * @throws com.github.dockerjava.api.NotFoundException | |
| 74 | 81 | * No such container | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,14 +24,16 @@ | |||
| 24 | 24 | * @param since | |
| 25 | 25 | * - UNIX timestamp (integer) to filter logs. Specifying a timestamp will only output log-entries since that timestamp. Default: | |
| 26 | 26 | * 0 (unfiltered) | |
| 27 | + * @param until | ||
| 28 | + * - Only return logs before this time, as a UNIX timestamp. Default: 0 | ||
| 27 | 29 | */ | |
| 28 | 30 | public class LogContainerCmdImpl extends AbstrAsyncDockerCmd<LogContainerCmd, Frame> implements LogContainerCmd { | |
| 29 | 31 | ||
| 30 | 32 | private String containerId; | |
| 31 | 33 | ||
| 32 | 34 | private Boolean followStream, timestamps, stdout, stderr; | |
| 33 | 35 | ||
| 34 | - private Integer tail, since; | ||
| 36 | + private Integer tail, since, until; | ||
| 35 | 37 | ||
| 36 | 38 | public LogContainerCmdImpl(LogContainerCmd.Exec exec, String containerId) { | |
| 37 | 39 | super(exec); | |
@@ -73,6 +75,11 @@ public Integer getSince() { | |||
| 73 | 75 | return since; | |
| 74 | 76 | } | |
| 75 | 77 | ||
| 78 | + @Override | ||
| 79 | + public Integer getUntil() { | ||
| 80 | + return until; | ||
| 81 | + } | ||
| 82 | + | ||
| 76 | 83 | @Override | |
| 77 | 84 | public LogContainerCmd withContainerId(String containerId) { | |
| 78 | 85 | checkNotNull(containerId, "containerId was not specified"); | |
@@ -122,6 +129,12 @@ public LogContainerCmd withSince(Integer since) { | |||
| 122 | 129 | return this; | |
| 123 | 130 | } | |
| 124 | 131 | ||
| 132 | + @Override | ||
| 133 | + public LogContainerCmd withUntil(Integer until) { | ||
| 134 | + this.until = until; | ||
| 135 | + return this; | ||
| 136 | + } | ||
| 137 | + | ||
| 125 | 138 | @Override | |
| 126 | 139 | public String toString() { | |
| 127 | 140 | return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -32,6 +32,10 @@ protected Void execute0(LogContainerCmd command, ResultCallback<Frame> resultCal | |||
| 32 | 32 | webTarget = webTarget.queryParam("since", command.getSince()); | |
| 33 | 33 | } | |
| 34 | 34 | ||
| 35 | + if (command.getUntil() != null) { | ||
| 36 | + webTarget = webTarget.queryParam("until", command.getUntil()); | ||
| 37 | + } | ||
| 38 | + | ||
| 35 | 39 | webTarget = booleanQueryParam(webTarget, "timestamps", command.hasTimestampsEnabled()); | |
| 36 | 40 | webTarget = booleanQueryParam(webTarget, "stdout", command.hasStdoutEnabled()); | |
| 37 | 41 | webTarget = booleanQueryParam(webTarget, "stderr", command.hasStderrEnabled()); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -206,6 +206,7 @@ public void asyncLogContainerWithSince() throws Exception { | |||
| 206 | 206 | .withStdErr(true) | |
| 207 | 207 | .withStdOut(true) | |
| 208 | 208 | .withSince(timestamp) | |
| 209 | + .withUntil(timestamp + 1000) | ||
| 209 | 210 | .exec(loggingCallback); | |
| 210 | 211 | ||
| 211 | 212 | loggingCallback.awaitCompletion(); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments