Logging Extension for Yii framework for communication with Sentry logging API
Yii Sentry is composer library so you can install the latest version with:
composer require websupport/yii-sentry
Add following to your application's config:
'components' => [
'log' => [
'class' => \CLogRouter::class,
'routes' => [
// your other log routers
array(
'class' => \Websupport\YiiSentry\LogRoute::class,
'levels' => E_ALL,
'enabled' => !YII_DEBUG,
],
],
],
'sentry' => [
'class' => \Websupport\YiiSentry\Client::class,
'dsn' => '', // Your's DSN from Sentry
],
)
'preload' => ['sentry'],
'components' => [
'sentry' => [
'class' => \Websupport\YiiSentry\Client::class,
'jsDsn' => '', // Your's DSN from Sentry
],
]
\Websupport\YiiSentry\Client
component has public method: setJsUserContext($context)
which will send $context
to Raven JS instance.
You can call this method multiple times from any part of the system. Recommended way however is to use it in CWebUser
class right after init.