diff --git a/src/Debugger/Logger.php b/src/Debugger/Logger.php index bf71d16..48b78b5 100644 --- a/src/Debugger/Logger.php +++ b/src/Debugger/Logger.php @@ -64,7 +64,7 @@ public function log($message, string $level = self::INFO): string $this->storage->put("tracy-logs/{$date}--app-json.log", $json); } - if (array_key_exists('LOG_MAIL', $_ENV) && $_ENV['LOG_MAIL'] !== '') { + if (array_key_exists('LOG_MAIL', $_ENV) && $_ENV['LOG_MAIL'] !== '' && !in_array($level, [self::DEBUG, self::INFO])) { $this->sendMail($context); } @@ -110,6 +110,7 @@ private function sendMail(array $context): void { $snooze = strtotime('1 day') - time(); $body = array_map(function ($key, $value) { + $value = is_array($value) ? json_encode($value) : $value; return "{$key}: {$value}"; }, array_keys($context), $context);