Search code examples
laravellaravel-5bugsnag

Disable bugsnag on certain instances


I'm trying to use bugsnag for Laravel 5. I got some instances of my application: local, a couple of production, testing etc.

In this https://github.com/bugsnag/bugsnag-laravel documentation it says that I need to replace the Exception handler to Bugsnag handler. But how can I disable Bugsnag for some of my instances?

I made an .env file where I put the apikey, so it'd cool not to use Bugsnag if I don't have that key set (for example).

Right now each instance I create needs apikey or it won't work, and this is a little bin inconvenient. Also, if I put Bugsnag notifications inside my code, what would be the best way to use them only if the env/config var is set, I guess manually checking is not a good idea.


Solution

  • Bugsnag has a config option for this now:

    Bugsnag::setNotifyReleaseStages(['development', 'production']);

    This restricts the reporting to the configured environments.