public function send(string $priority, string $message, array $context = [])
    {
        if (! $this->contextContainsException($context)) {
            $data = [
                'extra' => $this->sanitizer->sanitize($context),
                'level' => $priority,
            ];

            $this->client->captureMessage(
                $message,
                [],
                $data,
                $this->stackTrace->cleanBacktrace(debug_backtrace())
            );

            return;
        }

        /** @var \Exception $exception */
        $exception = $context['exception'];
        unset($context['exception']);

        $exceptionsStack = $this->stackTrace->getExceptions($exception);

        // Adding a first fake exception to log the message
        $stack = $this->stackTrace->cleanBacktrace(debug_backtrace());
        $exceptionsStack[] = [
            'value' => $message,
            'type' => get_class($exception),
            'stacktrace' => [
                'frames' => $this->stackTrace->getStackTraceFrames($stack),
            ],
        ];

        $data = [
            'extra' => $this->sanitizer->sanitize($context),
            'level' => $priority,
            'exception' => [
                'values' => $exceptionsStack,
            ],
        ];

        $this->client->captureMessage($message, [], $data);
    }
public function send(string $priority, string $message, array $context = [])
    {
        if (! $this->contextContainsException($context)) {
            $data = [
                'extra' => $this->sanitizer->sanitize($context),
                'level' => $priority,
            ];

            $this->client->captureMessage(
                $message,
                [],
                $data,
                $this->stackTrace->cleanBacktrace(debug_backtrace())
            );

            return;
        }

        /** @var \Exception $exception */
        $exception = $context['exception'];
        unset($context['exception']);

        $exceptionsStack = $this->stackTrace->getExceptions($exception);

        // Adding a first fake exception to log the message
        $stack = $this->stackTrace->cleanBacktrace(debug_backtrace());
        $exceptionsStack[] = [
            'value' => $message,
            'type' => get_class($exception),
            'stacktrace' => [
                'frames' => $this->stackTrace->getStackTraceFrames($stack),
            ],
        ];

        $data = [
            'extra' => $this->sanitizer->sanitize($context),
            'level' => $priority,
            'exception' => [
                'values' => $exceptionsStack,
            ],
        ];

        $this->client->captureMessage($message, [], $data);
    }
public function send ( string $ priority , string $ message , array $ context = [ ] ) { if ( ! $ this -> contextContainsException ( $ context ) ) { $ data = [ 'extra' => $ this -> sanitizer -> sanitize ( $ context ) , 'level' => $ priority , ] ; $ this -> client -> captureMessage ( $ message , [ ] , $ data , $ this -> stackTrace -> cleanBacktrace ( debug_backtrace ( ) ) ) ; return ; } /** @var \Exception $exception */ $ exception = $ context [ 'exception' ] ; unset ( $ context [ 'exception' ] ) ; $ exceptionsStack = $ this -> stackTrace -> getExceptions ( $ exception ) ; // Adding a first fake exception to log the message $ stack = $ this -> stackTrace -> cleanBacktrace ( debug_backtrace ( ) ) ; $ exceptionsStack [ ] = [ 'value' => $ message , 'type' => get_class ( $ exception ) , 'stacktrace' => [ 'frames' => $ this -> stackTrace -> getStackTraceFrames ( $ stack ) , ] , ] ; $ data = [ 'extra' => $ this -> sanitizer -> sanitize ( $ context ) , 'level' => $ priority , 'exception' => [ 'values' => $ exceptionsStack , ] , ] ; $ this -> client -> captureMessage ( $ message , [ ] , $ data ) ; }
Send the log

@param string $priority Sentry priority
@param string $message Log Message
@param array $context Log context
Send the log