Created
August 26, 2015 23:36
-
-
Save duellsy/8e23b65b4d91aa19775d to your computer and use it in GitHub Desktop.
Using Rollbar in Laravel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this is in app/Exceptions/Handler.php | |
// rollbar/rollbar installed via composer | |
public function report(Exception $e) | |
{ | |
if (!Config::get('app.debug') && $e->getStatusCode() != '404') { | |
$conf = [ | |
'access_token' => Config::get('services.rollbar.access_token'), | |
'environment' => App::environment(), | |
'root' => app_path(), | |
'code_version' => Html::gitVersion() // custom method that gets us the current git version | |
]; | |
if (Auth::check()) { | |
// add in the user info if available, to contact them if need be | |
$conf['person'] = [ | |
'id' => Auth::user()->id, | |
'email' => Auth::user()->email | |
]; | |
} | |
Rollbar::init($conf); | |
Rollbar::report_exception($e); | |
} | |
return parent::report($e); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment