| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -23,8 +23,8 @@ | |||
| 23 | 23 | * @param tail | |
| 24 | 24 | * - `all` or `<number>`, Output specified number of lines at the end of logs | |
| 25 | 25 | * @param since | |
| 26 | - * - UNIX timestamp, RFC 3339 date, or Go duration string to filter logs. | ||
| 27 | - * Specifying a timestamp will only output log-entries since that timestamp. Default: 0 (unfiltered) | ||
| 26 | + * - UNIX timestamp (integer) to filter logs. Specifying a timestamp will only output log-entries since that timestamp. Default: | ||
| 27 | + * 0 (unfiltered) | ||
| 28 | 28 | */ | |
| 29 | 29 | public interface LogContainerCmd extends AsyncDockerCmd<LogContainerCmd, Frame> { | |
| 30 | 30 | ||
@@ -47,7 +47,7 @@ public interface LogContainerCmd extends AsyncDockerCmd<LogContainerCmd, Frame> | |||
| 47 | 47 | Boolean hasStderrEnabled(); | |
| 48 | 48 | ||
| 49 | 49 | @CheckForNull | |
| 50 | - String getSince(); | ||
| 50 | + Integer getSince(); | ||
| 51 | 51 | ||
| 52 | 52 | LogContainerCmd withContainerId(@Nonnull String containerId); | |
| 53 | 53 | ||
@@ -67,7 +67,7 @@ public interface LogContainerCmd extends AsyncDockerCmd<LogContainerCmd, Frame> | |||
| 67 | 67 | ||
| 68 | 68 | LogContainerCmd withTail(Integer tail); | |
| 69 | 69 | ||
| 70 | - LogContainerCmd withSince(String since); | ||
| 70 | + LogContainerCmd withSince(Integer since); | ||
| 71 | 71 | ||
| 72 | 72 | /** | |
| 73 | 73 | * @throws com.github.dockerjava.api.NotFoundException | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,17 +22,16 @@ | |||
| 22 | 22 | * @param tail | |
| 23 | 23 | * - `all` or `<number>`, Output specified number of lines at the end of logs | |
| 24 | 24 | * @param since | |
| 25 | - * - UNIX timestamp, RFC 3339 date, or Go duration string to filter logs. | ||
| 26 | - * Specifying a timestamp will only output log-entries since that timestamp. Default: 0 (unfiltered) | ||
| 25 | + * - UNIX timestamp (integer) to filter logs. Specifying a timestamp will only output log-entries since that timestamp. Default: | ||
| 26 | + * 0 (unfiltered) | ||
| 27 | 27 | */ | |
| 28 | 28 | public class LogContainerCmdImpl extends AbstrAsyncDockerCmd<LogContainerCmd, Frame> implements LogContainerCmd { | |
| 29 | 29 | ||
| 30 | 30 | private String containerId; | |
| 31 | 31 | ||
| 32 | 32 | private Boolean followStream, timestamps, stdout, stderr; | |
| 33 | 33 | ||
| 34 | - private Integer tail; | ||
| 35 | - private String since; | ||
| 34 | + private Integer tail, since; | ||
| 36 | 35 | ||
| 37 | 36 | public LogContainerCmdImpl(LogContainerCmd.Exec exec, String containerId) { | |
| 38 | 37 | super(exec); | |
@@ -70,7 +69,7 @@ public Boolean hasStderrEnabled() { | |||
| 70 | 69 | } | |
| 71 | 70 | ||
| 72 | 71 | @Override | |
| 73 | - public String getSince() { | ||
| 72 | + public Integer getSince() { | ||
| 74 | 73 | return since; | |
| 75 | 74 | } | |
| 76 | 75 | ||
@@ -118,7 +117,7 @@ public LogContainerCmd withTail(Integer tail) { | |||
| 118 | 117 | } | |
| 119 | 118 | ||
| 120 | 119 | @Override | |
| 121 | - public LogContainerCmd withSince(String since) { | ||
| 120 | + public LogContainerCmd withSince(Integer since) { | ||
| 122 | 121 | this.since = since; | |
| 123 | 122 | return this; | |
| 124 | 123 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -175,7 +175,7 @@ public void asyncLogContainerWithSince() throws Exception { | |||
| 175 | 175 | LOG.info("Created container: {}", container.toString()); | |
| 176 | 176 | assertThat(container.getId(), not(isEmptyString())); | |
| 177 | 177 | ||
| 178 | - String timestamp = String.valueOf(System.currentTimeMillis() / 1000); | ||
| 178 | + int timestamp = (int) (System.currentTimeMillis() / 1000); | ||
| 179 | 179 | ||
| 180 | 180 | dockerRule.getClient().startContainerCmd(container.getId()).exec(); | |
| 181 | 181 | ||
@@ -197,38 +197,4 @@ public void asyncLogContainerWithSince() throws Exception { | |||
| 197 | 197 | ||
| 198 | 198 | assertThat(loggingCallback.toString(), containsString(snippet)); | |
| 199 | 199 | } | |
| 200 | - | ||
| 201 | - @Test | ||
| 202 | - public void asyncLogContainerWithSinceNanoseconds() throws Exception { | ||
| 203 | - String snippet = "hello world"; | ||
| 204 | - | ||
| 205 | - CreateContainerResponse container = dockerRule.getClient().createContainerCmd("busybox") | ||
| 206 | - .withCmd("/bin/echo", snippet) | ||
| 207 | - .exec(); | ||
| 208 | - | ||
| 209 | - LOG.info("Created container: {}", container.toString()); | ||
| 210 | - assertThat(container.getId(), not(isEmptyString())); | ||
| 211 | - | ||
| 212 | - String timestamp = String.format("%.4f", System.currentTimeMillis() / 1000d); | ||
| 213 | - dockerRule.getClient().startContainerCmd(container.getId()).exec(); | ||
| 214 | - | ||
| 215 | - int exitCode = dockerRule.getClient().waitContainerCmd(container.getId()) | ||
| 216 | - .exec(new WaitContainerResultCallback()) | ||
| 217 | - .awaitStatusCode(); | ||
| 218 | - | ||
| 219 | - assertThat(exitCode, equalTo(0)); | ||
| 220 | - | ||
| 221 | - LogContainerTestCallback loggingCallback = new LogContainerTestCallback(); | ||
| 222 | - | ||
| 223 | - dockerRule.getClient().logContainerCmd(container.getId()) | ||
| 224 | - .withStdErr(true) | ||
| 225 | - .withStdOut(true) | ||
| 226 | - .withTimestamps(true) | ||
| 227 | - .withSince(timestamp) | ||
| 228 | - .exec(loggingCallback); | ||
| 229 | - | ||
| 230 | - loggingCallback.awaitCompletion(); | ||
| 231 | - | ||
| 232 | - assertThat(loggingCallback.toString(), containsString(snippet)); | ||
| 233 | - } | ||
| 234 | 200 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments