Yii not reporting user informations
koffisani opened this issue · 1 comments
koffisani commented
I just configured this plugin as follows :
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
[
'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning','info'],
],
[
'class' => 'notamedia\sentry\SentryTarget',
'dsn' => 'http://<id>@<server-address>/4',
'levels' => ['error', 'warning'],
// Write the context information (the default is true):
'context' => true,
// Additional options for `Sentry\init`:
//'clientOptions' => ['release' => 'my-project-name@2.3.12']
'on beforeAction' => function (\yii\base\ActionEvent $event) {
Yii::error("Test");
/** @var \yii\web\User $user */
$user = Yii::$app->has('user', true) ? Yii::$app->get('user', false) : null;
if ($user && ($identity = $user->getIdentity(true))) {
\Sentry\configureScope(function (\Sentry\State\Scope $scope) use ($identity) {
$scope->setUser([
// User ID and IP will be added by logger automatically
'username' => $identity->username,
'email' => $identity->email,
]);
});
}
return $event->isValid;
},
],
],
],
But unfortunately, only user's ID and IP are reported. Is there anything I've done wrong ? Thanks.
CookiesEater commented
Hi!
Sorry, but for now behavior of this feature is broken in sentry-php, please track this issue: getsentry/sentry-php#1175