Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change containerLogs() to return STDOUT and STDERR by default #54

Merged
merged 1 commit into from
Sep 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,8 @@ public function containerTop($container, $ps_args = null)
*
* @param string $container container ID
* @param boolean $follow 1/True/true or 0/False/false, return stream. Default false
* @param boolean $stdout 1/True/true or 0/False/false, show stdout log. Default false
* @param boolean $stderr 1/True/true or 0/False/false, show stderr log. Default false
* @param boolean $stdout 1/True/true or 0/False/false, show stdout log. Default true
* @param boolean $stderr 1/True/true or 0/False/false, show stderr log. Default true
* @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+)
* @param boolean $timestamps 1/True/true or 0/False/false, print timestamps for every log line. Default false
* @param int|null $tail Output specified number of lines at the end of logs: all or <number>. Default all
Expand All @@ -287,7 +287,7 @@ public function containerTop($container, $ps_args = null)
* @uses self::containerLogsStream()
* @see self::containerLogsStream()
*/
public function containerLogs($container, $follow = false, $stdout = false, $stderr = false, $since = 0, $timestamps = false, $tail = null)
public function containerLogs($container, $follow = false, $stdout = true, $stderr = true, $since = 0, $timestamps = false, $tail = null)
{
return $this->streamingParser->bufferedStream(
$this->containerLogsStream($container, $follow, $stdout, $stderr, $since, $timestamps, $tail)
Expand Down Expand Up @@ -323,8 +323,8 @@ public function containerLogs($container, $follow = false, $stdout = false, $std
*
* @param string $container container ID
* @param boolean $follow 1/True/true or 0/False/false, return stream. Default false
* @param boolean $stdout 1/True/true or 0/False/false, show stdout log. Default false
* @param boolean $stderr 1/True/true or 0/False/false, show stderr log. Default false
* @param boolean $stdout 1/True/true or 0/False/false, show stdout log. Default true
* @param boolean $stderr 1/True/true or 0/False/false, show stderr log. Default true
* @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+)
* @param boolean $timestamps 1/True/true or 0/False/false, print timestamps for every log line. Default false
* @param int|null $tail Output specified number of lines at the end of logs: all or <number>. Default all
Expand All @@ -333,7 +333,7 @@ public function containerLogs($container, $follow = false, $stdout = false, $std
* @link https://docs.docker.com/engine/api/v1.40/#operation/ContainerLogs
* @see self::containerLogs()
*/
public function containerLogsStream($container, $follow = false, $stdout = false, $stderr = false, $since = 0, $timestamps = false, $tail = null, $stderrEvent = null)
public function containerLogsStream($container, $follow = false, $stdout = true, $stderr = true, $since = 0, $timestamps = false, $tail = null, $stderrEvent = null)
{
$parser = $this->streamingParser;
$browser = $this->browser;
Expand Down
8 changes: 4 additions & 4 deletions tests/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public function testContainerLogsReturnsPendingPromiseWhenInspectingContainerRes
$this->browser->expects($this->once())->method('withOptions')->willReturnSelf();
$this->browser->expects($this->exactly(2))->method('get')->withConsecutive(
array('/containers/123/json'),
array('/containers/123/logs')
array('/containers/123/logs?stdout=1&stderr=1')
)->willReturnOnConsecutiveCalls(
\React\Promise\resolve(new Response(200, array(), '{"Config":{"Tty":true}}')),
new \React\Promise\Promise(function () { })
Expand All @@ -216,7 +216,7 @@ public function testContainerLogsReturnsPendingPromiseWhenInspectingContainerRes
$this->browser->expects($this->once())->method('withOptions')->willReturnSelf();
$this->browser->expects($this->exactly(2))->method('get')->withConsecutive(
array('/containers/123/json'),
array('/containers/123/logs')
array('/containers/123/logs?stdout=1&stderr=1')
)->willReturnOnConsecutiveCalls(
\React\Promise\resolve(new Response(200, array(), '{"Config":{"Tty":false}}')),
new \React\Promise\Promise(function () { })
Expand All @@ -237,7 +237,7 @@ public function testContainerLogsResolvesWhenInspectingContainerResolvesWithTtyA
$this->browser->expects($this->once())->method('withOptions')->willReturnSelf();
$this->browser->expects($this->exactly(2))->method('get')->withConsecutive(
array('/containers/123/json'),
array('/containers/123/logs')
array('/containers/123/logs?stdout=1&stderr=1')
)->willReturnOnConsecutiveCalls(
\React\Promise\resolve(new Response(200, array(), '{"Config":{"Tty":true}}')),
\React\Promise\resolve(new Response(200, array(), ''))
Expand All @@ -258,7 +258,7 @@ public function testContainerLogsStreamReturnStreamWhenInspectingContainerResolv
$this->browser->expects($this->once())->method('withOptions')->willReturnSelf();
$this->browser->expects($this->exactly(2))->method('get')->withConsecutive(
array('/containers/123/json'),
array('/containers/123/logs')
array('/containers/123/logs?stdout=1&stderr=1')
)->willReturnOnConsecutiveCalls(
\React\Promise\resolve(new Response(200, array(), '{"Config":{"Tty":true}}')),
\React\Promise\resolve(new Response(200, array(), ''))
Expand Down