Skip to content

Commit fdea8c3

Browse files
authored
Merge pull request #54 from clue-labs/logs
Change `containerLogs()` to return STDOUT and STDERR by default
2 parents 66bdc29 + 59637e9 commit fdea8c3

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

src/Client.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,8 @@ public function containerTop($container, $ps_args = null)
277277
*
278278
* @param string $container container ID
279279
* @param boolean $follow 1/True/true or 0/False/false, return stream. Default false
280-
* @param boolean $stdout 1/True/true or 0/False/false, show stdout log. Default false
281-
* @param boolean $stderr 1/True/true or 0/False/false, show stderr log. Default false
280+
* @param boolean $stdout 1/True/true or 0/False/false, show stdout log. Default true
281+
* @param boolean $stderr 1/True/true or 0/False/false, show stderr log. Default true
282282
* @param int $since UNIX timestamp (integer) to filter logs. Specifying a timestamp will only output log-entries since that timestamp. Default: 0 (unfiltered) (requires API v1.19+ / Docker v1.7+)
283283
* @param boolean $timestamps 1/True/true or 0/False/false, print timestamps for every log line. Default false
284284
* @param int|null $tail Output specified number of lines at the end of logs: all or <number>. Default all
@@ -287,7 +287,7 @@ public function containerTop($container, $ps_args = null)
287287
* @uses self::containerLogsStream()
288288
* @see self::containerLogsStream()
289289
*/
290-
public function containerLogs($container, $follow = false, $stdout = false, $stderr = false, $since = 0, $timestamps = false, $tail = null)
290+
public function containerLogs($container, $follow = false, $stdout = true, $stderr = true, $since = 0, $timestamps = false, $tail = null)
291291
{
292292
return $this->streamingParser->bufferedStream(
293293
$this->containerLogsStream($container, $follow, $stdout, $stderr, $since, $timestamps, $tail)
@@ -323,8 +323,8 @@ public function containerLogs($container, $follow = false, $stdout = false, $std
323323
*
324324
* @param string $container container ID
325325
* @param boolean $follow 1/True/true or 0/False/false, return stream. Default false
326-
* @param boolean $stdout 1/True/true or 0/False/false, show stdout log. Default false
327-
* @param boolean $stderr 1/True/true or 0/False/false, show stderr log. Default false
326+
* @param boolean $stdout 1/True/true or 0/False/false, show stdout log. Default true
327+
* @param boolean $stderr 1/True/true or 0/False/false, show stderr log. Default true
328328
* @param int $since UNIX timestamp (integer) to filter logs. Specifying a timestamp will only output log-entries since that timestamp. Default: 0 (unfiltered) (requires API v1.19+ / Docker v1.7+)
329329
* @param boolean $timestamps 1/True/true or 0/False/false, print timestamps for every log line. Default false
330330
* @param int|null $tail Output specified number of lines at the end of logs: all or <number>. Default all
@@ -333,7 +333,7 @@ public function containerLogs($container, $follow = false, $stdout = false, $std
333333
* @link https://docs.docker.com/engine/api/v1.40/#operation/ContainerLogs
334334
* @see self::containerLogs()
335335
*/
336-
public function containerLogsStream($container, $follow = false, $stdout = false, $stderr = false, $since = 0, $timestamps = false, $tail = null, $stderrEvent = null)
336+
public function containerLogsStream($container, $follow = false, $stdout = true, $stderr = true, $since = 0, $timestamps = false, $tail = null, $stderrEvent = null)
337337
{
338338
$parser = $this->streamingParser;
339339
$browser = $this->browser;

tests/ClientTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ public function testContainerLogsReturnsPendingPromiseWhenInspectingContainerRes
195195
$this->browser->expects($this->once())->method('withOptions')->willReturnSelf();
196196
$this->browser->expects($this->exactly(2))->method('get')->withConsecutive(
197197
array('/containers/123/json'),
198-
array('/containers/123/logs')
198+
array('/containers/123/logs?stdout=1&stderr=1')
199199
)->willReturnOnConsecutiveCalls(
200200
\React\Promise\resolve(new Response(200, array(), '{"Config":{"Tty":true}}')),
201201
new \React\Promise\Promise(function () { })
@@ -216,7 +216,7 @@ public function testContainerLogsReturnsPendingPromiseWhenInspectingContainerRes
216216
$this->browser->expects($this->once())->method('withOptions')->willReturnSelf();
217217
$this->browser->expects($this->exactly(2))->method('get')->withConsecutive(
218218
array('/containers/123/json'),
219-
array('/containers/123/logs')
219+
array('/containers/123/logs?stdout=1&stderr=1')
220220
)->willReturnOnConsecutiveCalls(
221221
\React\Promise\resolve(new Response(200, array(), '{"Config":{"Tty":false}}')),
222222
new \React\Promise\Promise(function () { })
@@ -237,7 +237,7 @@ public function testContainerLogsResolvesWhenInspectingContainerResolvesWithTtyA
237237
$this->browser->expects($this->once())->method('withOptions')->willReturnSelf();
238238
$this->browser->expects($this->exactly(2))->method('get')->withConsecutive(
239239
array('/containers/123/json'),
240-
array('/containers/123/logs')
240+
array('/containers/123/logs?stdout=1&stderr=1')
241241
)->willReturnOnConsecutiveCalls(
242242
\React\Promise\resolve(new Response(200, array(), '{"Config":{"Tty":true}}')),
243243
\React\Promise\resolve(new Response(200, array(), ''))
@@ -258,7 +258,7 @@ public function testContainerLogsStreamReturnStreamWhenInspectingContainerResolv
258258
$this->browser->expects($this->once())->method('withOptions')->willReturnSelf();
259259
$this->browser->expects($this->exactly(2))->method('get')->withConsecutive(
260260
array('/containers/123/json'),
261-
array('/containers/123/logs')
261+
array('/containers/123/logs?stdout=1&stderr=1')
262262
)->willReturnOnConsecutiveCalls(
263263
\React\Promise\resolve(new Response(200, array(), '{"Config":{"Tty":true}}')),
264264
\React\Promise\resolve(new Response(200, array(), ''))

0 commit comments

Comments
 (0)