summaryrefslogtreecommitdiff
path: root/src/Format.php
diff options
context:
space:
mode:
authorAsko Nõmm <asko@nth.ee>2024-11-15 17:36:55 +0200
committerAsko Nõmm <asko@nth.ee>2024-11-15 17:36:55 +0200
commitc6221eb4fe29ddf8a09f7fdb4277758716269bd6 (patch)
tree409484067297ec4639acc824faef0870aa31f3a4 /src/Format.php
parent086d719dc61d2c531e0b9fa51678b8e2f34dafdb (diff)
Improve tests.
Diffstat (limited to 'src/Format.php')
-rw-r--r--src/Format.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Format.php b/src/Format.php
index 4517e0a..fa1c215 100644
--- a/src/Format.php
+++ b/src/Format.php
@@ -43,7 +43,7 @@ enum Format
/** @var string $trace_line */
$trace_line = $message->trace['line'];
- return json_encode([
+ $json = json_encode([
'date' => $dateTime->format('Y-m-d H:i:s'),
'level' => strtoupper($message->level->value),
'message' => $message->content,
@@ -53,6 +53,12 @@ enum Format
'line' => $trace_line,
],
]);
+
+ if (!$json) {
+ return '';
+ }
+
+ return $json;
}
/**