Skip to content

Commit ae0acb9

Browse files
authored
fix: ensures logging sample can handle non-string results (GoogleCloudPlatform#1020)
1 parent 78c05f3 commit ae0acb9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

logging/src/sink_functions.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,10 @@ function list_sinks($projectId)
7171
foreach ($sinks as $sink) {
7272
/* @var $sink \Google\Cloud\Logging\Sink */
7373
foreach ($sink->info() as $key => $value) {
74-
print "$key:$value\n";
74+
printf('%s:%s' . PHP_EOL,
75+
$key,
76+
is_string($value) ? $value : var_export($value, true)
77+
);
7578
}
7679
print PHP_EOL;
7780
}

0 commit comments

Comments
 (0)