File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,9 @@ class AirbrakeService extends Component
2828 /** @var string|null Run-time environment (optional) */
2929 public $ environment ;
3030
31+ /** @var mixed Run-time user (optional) */
32+ public $ user ;
33+
3134 /** @var ParamsFilter[] Items of the array will be added as filters */
3235 public $ filters ;
3336
@@ -77,6 +80,7 @@ public function init()
7780 'environment ' => $ this ->environment ,
7881 'rootDirectory ' => Yii::getAlias ($ this ->rootDirectory ),
7982 'host ' => $ this ->host ,
83+ 'user ' => $ this ->user ,
8084 ]);
8185
8286 if (is_array ($ this ->filters )) {
Original file line number Diff line number Diff line change 77
88class Notifier extends AirbrakeNotifier
99{
10+ private $ user ;
11+
12+ public function __construct ($ opt )
13+ {
14+ parent ::__construct ($ opt );
15+
16+ $ this ->user = $ opt ['user ' ];
17+ }
18+
1019 public function buildNotice ($ exc )
1120 {
1221 $ notice = parent ::buildNotice ($ exc );
@@ -17,12 +26,10 @@ public function buildNotice($exc)
1726 $ notice ['context ' ]['user ' ]['id ' ] = $ user ->id ;
1827 }
1928 if (isset ($ user ->identity )) {
20- $ notice ['context ' ]['user ' ]['name ' ] = $ user ->identity ->nombre ;
21- $ notice ['context ' ]['user ' ]['email ' ] = $ user ->identity ->email ;
29+ $ notice ['context ' ]['user ' ] = $ this ->user ->call ($ this , $ user ->identity );
2230 }
2331 }
2432
2533 return $ notice ;
2634 }
27-
2835}
You can’t perform that action at this time.
0 commit comments