darkair / yii2-sentry-log
Simple Yii2 Sentry target for logging (http://getsentry.com)
Installs: 1 774
Dependents: 1
Suggesters: 0
Security: 0
Stars: 3
Watchers: 3
Forks: 6
Open Issues: 2
Type:yii2-extension
pkg:composer/darkair/yii2-sentry-log
Requires
- php: >=5.4.0
- raven/raven: 0.8.0
Requires (Dev)
- yiisoft/yii2: *
This package is not auto-updated.
Last update: 2025-10-25 23:21:34 UTC
README
Yii2 Sentry target for logging based on Raven client.
Installation
The preferred way to install this extension is through composer.
Either run
$ php composer.phar require darkair/yii2-sentry-log "dev-master"
or add
"darkair/yii2-sentry-log": "dev-master"
to the require section of your composer.json file.
Usage
Add target class in your project config:
'components' => [
    'log' => [
        'targets' => [
            [
                'class' => 'sentry\SentryTarget',
                'levels' => ['error', 'warning'],   // or smth else
                'dsn' => '',                        // sentry access string
            ],
        ],
    ],
Then use like ordinary log:
Yii::error('some string');
or
Yii::error([
    'msg' => 'some message',
    'data' => [...],                // Any pair key=>value for adding to the sentry message 
]);
Note
Because the mechanism of logging is asyncronical, standard sentry stacktrace is unavailable. But this extension sends logger stacktrace in extra parameters of message.