Skip to content

Commit 99c931c

Browse files
authored
Merge pull request #200 from splitio/fix/arrayConversionLogging
Fix/array conversion logging
2 parents 6dba2e7 + 19b466a commit 99c931c

File tree

7 files changed

+11
-4
lines changed

7 files changed

+11
-4
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- 6379:6379
2020
strategy:
2121
matrix:
22-
version: ['7.3', '8.0', '8.1']
22+
version: ['7.3', '8.0', '8.1', '8.2']
2323
steps:
2424
- name: Checkout code
2525
uses: actions/checkout@v2

CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
7.1.6 (Feb 14, 2023)
2+
- Fixed logging on array conversion.
3+
14
7.1.5 (Oct 28, 2022)
25
- Updated phpdocs for `ClientInterface`.
36

src/SplitIO/Component/Log/Logger.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ public function __construct(LogHandlerInterface $handler = null, $level = LogLev
6060
public function log($level, $message, array $context = array())
6161
{
6262
if ($this->logLevels[$level] <= $this->logLevel) {
63+
if (is_array($message)) {
64+
$message = json_encode($message);
65+
}
6366
$this->handler->write($level, $message);
6467
}
6568
}

src/SplitIO/Sdk/Client.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class Client implements ClientInterface
1919

2020
private $evaluator = null;
2121
private $impressionListener = null;
22+
private $queueMetadata = null;
2223

2324
/**
2425
* Flag to get Impression's labels feature enabled

src/SplitIO/TreatmentImpression.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ class TreatmentImpression
1515
public static function log($impressions, QueueMetadataMessage $metadata)
1616
{
1717
try {
18-
Di::getLogger()->debug($impressions);
1918
if (is_null($impressions) || (is_array($impressions) && 0 == count($impressions))) {
19+
Di::getLogger()->debug("no impressions were sent");
2020
return null;
2121
}
2222
$impressionCache = new ImpressionCache();

src/SplitIO/Version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33

44
class Version
55
{
6-
const CURRENT = '7.1.5';
6+
const CURRENT = '7.1.6';
77
}

tests/Suite/Sdk/SdkReadOnlyTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function testException()
9090
->getMock();
9191

9292
// Discard (ignore) first logging statement
93-
$logger->expects($this->exactly(2))
93+
$logger->expects($this->exactly(1))
9494
->method('debug');
9595

9696
$logger->expects($this->exactly(2))

0 commit comments

Comments
 (0)