jenssegers / laravel-rollbar

Rollbar error monitoring integration for Laravel projects
329 stars 99 forks source link

Capacity to override default person without resorting to context in every log statement #82

Closed paulrrogers closed 7 years ago

paulrrogers commented 7 years ago

There does not appear to be any way to set the signed-in person's details (ID, username, etc.) without explicitly doing so with every log statement. Am I missing something?

squatto commented 7 years ago

In your config (/config/services.php) you can set person_fn to Auth::user (or any function that returns the user). For example:

'rollbar' => [
    'access_token' => env('ROLLBAR_TOKEN'),
    'level' => env('ROLLBAR_LEVEL'),
    'person_fn' => 'Auth::user',
],

This will send the currently-authenticated user with every Rollbar error report.