Jump to content

Integrate Bugsnag with Invision


Recommended Posts

I'm not too familiar yet with Invision's codebase but would it be easy to register a class early in the booting of the app for something like reporting 500 errors or other weird exceptions to a service like Bugsnag? Integration is generally easy in other PHP apps but would like to see if it could be done with Invision without altering the main source code.

Bugsnag docs › Platforms › PHP › Other

Link to comment
Share on other sites

Yea, IPS\Dispatcher\Standard seems like a good spot!

If you care about literally anything and if you want to log "everything" , you could even hook into IPS\Dispatcher! 

I'm doing something similar with rollbar:

 

//<?php

/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
	exit;
}

abstract class rollbar_hook_dispatcher_standard extends _HOOK_CLASS_
{

	public function init()
	{
		$this->initRollbar();
		parent::init();
	}


	protected function initRollbar()
	{
		if ( \IPS\Settings::i()->rollbarapikey )
		{
			require_once \IPS\Application::getRootPath('rollbar')  . '/sources/vendor/autoload.php';
			$config = array(
				'access_token' => \IPS\Settings::i()->rollbarapikey,
				'environment' => \IPS\Settings::i()->base_url,
				'root' => \IPS\ROOT_PATH
			);
			\Rollbar\Rollbar::init($config);
		}
	}
}

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...