Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
AncientMariner Posted March 30, 2021 Posted March 30, 2021 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
AncientMariner Posted March 30, 2021 Author Posted March 30, 2021 Got it working in a custom IPS\Dispatcher\Front hook but thinking we may need to create a hook for IPS\Dispatcher\Standard to get API errors. Welcome any advice. 🙂
Daniel F Posted March 31, 2021 Posted March 31, 2021 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); } } } AncientMariner and Ilya Hoilik 2
Recommended Posts