forked from docker-java/docker-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLogContainerCmdImpl.java
More file actions
142 lines (115 loc) · 3.46 KB
/
Copy pathLogContainerCmdImpl.java
File metadata and controls
142 lines (115 loc) · 3.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
package com.github.dockerjava.core.command;
import java.util.Objects;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.github.dockerjava.api.command.LogContainerCmd;
import com.github.dockerjava.api.model.Frame;
/**
* Get container logs
*
* @param followStream
* - true or false, return stream. Defaults to false.
* @param stdout
* - true or false, includes stdout log. Defaults to false.
* @param stderr
* - true or false, includes stderr log. Defaults to false.
* @param timestamps
* - true or false, if true, print timestamps for every log line. Defaults to false.
* @param tail
* - `all` or `<number>`, Output specified number of lines at the end of logs
* @param since
* - UNIX timestamp (integer) to filter logs. Specifying a timestamp will only output log-entries since that timestamp. Default:
* 0 (unfiltered)
* @param until
* - Only return logs before this time, as a UNIX timestamp. Default: 0
*/
public class LogContainerCmdImpl extends AbstrAsyncDockerCmd<LogContainerCmd, Frame> implements LogContainerCmd {
private String containerId;
private Boolean followStream, timestamps, stdout, stderr;
private Integer tail, since, until;
public LogContainerCmdImpl(LogContainerCmd.Exec exec, String containerId) {
super(exec);
withContainerId(containerId);
}
@Override
public String getContainerId() {
return containerId;
}
@Override
public Integer getTail() {
return tail;
}
@Override
public Boolean hasFollowStreamEnabled() {
return followStream;
}
@Override
public Boolean hasTimestampsEnabled() {
return timestamps;
}
@Override
public Boolean hasStdoutEnabled() {
return stdout;
}
@Override
public Boolean hasStderrEnabled() {
return stderr;
}
@Override
public Integer getSince() {
return since;
}
@Override
public Integer getUntil() {
return until;
}
@Override
public LogContainerCmd withContainerId(String containerId) {
this.containerId = Objects.requireNonNull(containerId, "containerId was not specified");
return this;
}
@Override
public LogContainerCmd withFollowStream(Boolean followStream) {
this.followStream = followStream;
return this;
}
@Override
public LogContainerCmd withTimestamps(Boolean timestamps) {
this.timestamps = timestamps;
return this;
}
@Override
public LogContainerCmd withStdOut(Boolean stdout) {
this.stdout = stdout;
return this;
}
@Override
public LogContainerCmd withStdErr(Boolean stderr) {
this.stderr = stderr;
return this;
}
@Override
public LogContainerCmd withTailAll() {
this.tail = -1;
return this;
}
@Override
public LogContainerCmd withTail(Integer tail) {
this.tail = tail;
return this;
}
@Override
public LogContainerCmd withSince(Integer since) {
this.since = since;
return this;
}
@Override
public LogContainerCmd withUntil(Integer until) {
this.until = until;
return this;
}
@Override
public String toString() {
return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
}
}