From c6221eb4fe29ddf8a09f7fdb4277758716269bd6 Mon Sep 17 00:00:00 2001 From: Asko Nõmm Date: Fri, 15 Nov 2024 17:36:55 +0200 Subject: Improve tests. --- src/Format.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/Format.php') 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; } /** -- cgit v1.2.3