summaryrefslogtreecommitdiff
path: root/src/Format.php
diff options
context:
space:
mode:
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;
}
/**