Open cameronscott137 opened 7 years ago
@cameronscott137 think that this will report the error twice to Rollbar because of the parent::report($exception);
which at the end will call
$logger->error(
$e->getMessage(),
array_merge($this->context(), ['exception' => $e]
));
Think that the better way is to overwrite the context
method from Illuminate\Foundation\Exceptions\Handler
like so:
/**
* Get the default context variables for logging.
*
* @return array
*/
protected function context()
{
$context = [
'userId' => Auth::id(),
// 'email' => optional(Auth::user())->email,
];
// If we have authenticated user
if (Auth::check()) {
$user = Auth::user();
$context['person'] = [
'id' => $user->id,
'username' => $user->name,
'email' => $user->email,
];
}
try {
return array_filter($context);
} catch (Throwable $e) {
return [];
}
}
What do you think?
Regards
Updates the ReadMe to include:
Auth
facade.$dontReport
array.