Fix service logs API to be able to specify stream
| ... | ... |
@@ -277,12 +277,22 @@ func (c *Cluster) ServiceLogs(ctx context.Context, input string, config *backend |
| 277 | 277 |
return err |
| 278 | 278 |
} |
| 279 | 279 |
|
| 280 |
+ // set the streams we'll use |
|
| 281 |
+ stdStreams := []swarmapi.LogStream{}
|
|
| 282 |
+ if config.ContainerLogsOptions.ShowStdout {
|
|
| 283 |
+ stdStreams = append(stdStreams, swarmapi.LogStreamStdout) |
|
| 284 |
+ } |
|
| 285 |
+ if config.ContainerLogsOptions.ShowStderr {
|
|
| 286 |
+ stdStreams = append(stdStreams, swarmapi.LogStreamStderr) |
|
| 287 |
+ } |
|
| 288 |
+ |
|
| 280 | 289 |
stream, err := state.logsClient.SubscribeLogs(ctx, &swarmapi.SubscribeLogsRequest{
|
| 281 | 290 |
Selector: &swarmapi.LogSelector{
|
| 282 | 291 |
ServiceIDs: []string{service.ID},
|
| 283 | 292 |
}, |
| 284 | 293 |
Options: &swarmapi.LogSubscriptionOptions{
|
| 285 |
- Follow: config.Follow, |
|
| 294 |
+ Follow: config.Follow, |
|
| 295 |
+ Streams: stdStreams, |
|
| 286 | 296 |
}, |
| 287 | 297 |
}) |
| 288 | 298 |
if err != nil {
|