protected function registerBugsnag()
    {
        $config = config('nodes.bugsnag');

        if (!in_array($this->app->environment(), config('nodes.bugsnag.notify_release_stages', []))) {
            return;
        }

        $this->app->singleton('nodes.bugsnag', function (Container $app) use ($config) {
            // Retrieve bugsnag settings
            $bugsnag = new Client(new Configuration($config['api_key']), new LaravelResolver($app), $this->getGuzzle($config));
            $this->setupPaths($bugsnag, $app->basePath(), $app->path(), base_path(), app_path());
            $bugsnag->setReleaseStage($app->environment());
            $bugsnag->setBatchSending(false);
            $bugsnag->setNotifier([
                'name'    => 'Nodes Bugsnag Laravel',
                'version' => self::VERSION,
                'url'     => 'http://packagist.com/nodes/bugsnag',
            ]);

            // Set notify release stages
            if (!empty($config['notify_release_stages'])) {
                $bugsnag->setNotifyReleaseStages((array) $config['notify_release_stages']);
            }

            // Set filters
            if (!empty($config['filters'])) {
                $bugsnag->setFilters((array) $config['filters']);
            }

            $bugsnag->registerDefaultCallbacks();

            // Attach user agent data to all exceptions
            $bugsnag->registerCallback(function (Report $report) {
                $report->setMetaData(['User Agent' => $this->gatherUserAgentData()]);
            });

            return $bugsnag;
        });

        $this->app->singleton('bugsnag.logger', function (Container $app) {
            return new LaravelLogger($app['nodes.bugsnag']);
        });

        $this->app->singleton('bugsnag.multi', function (Container $app) {
            return new MultiLogger([$app['log'], $app['bugsnag.logger']]);
        });

        $this->app->alias('nodes.bugsnag', Client::class);
        $this->app->alias('bugsnag.logger', LaravelLogger::class);
        $this->app->alias('bugsnag.multi', MultiLogger::class);
    }