0
7
Login
Code
Issues
Pull requests
Events
Packages
6df463743589cadd294c96f0b46f4cefb2f9ff2a
6df463743589cadd294c96f0b46f4cefb2f9ff2a

Sentry

Latest Test Latest Version on Packagist Total Downloads GitHub license

Installation

composer require friendsofhyperf/sentry

Publish config file

php bin/hyperf.php vendor:publish friendsofhyperf/sentry

Register exception handler

return [
    'handler' => [
        'http' => [
            FriendsOfHyperf\Sentry\SentryExceptionHandler::class,
            App\Exception\Handler\AppExceptionHandler::class,
        ],
    ],
];

Register logger handler

<?php

return [
    // ...
    'sentry' => [
        'handler' => [
            'class' => FriendsOfHyperf\Sentry\SentryHandler::class,
            'constructor' => [
                'level' => \Monolog\Logger::DEBUG,
            ],
        ],
        'formatter' => [
            'class' => \Monolog\Formatter\LineFormatter::class,
            'constructor' => [
                'format' => null,
                'dateFormat' => null,
                'allowInlineLineBreaks' => true,
            ]
        ],
    ],
    // ...
];

Annotation

<?php
namespace App;

use FriendsOfHyperf\Sentry\Annotation\Breadcrumb;

class Foo
{
    #[Breadcrumb(category: 'foo')]
    public function bar($a = 1, $b = 2)
    {
        return __METHOD__;
    }
}