From bc272dba95099d38a7a2d7e886902cba2a790e3f Mon Sep 17 00:00:00 2001 From: Artur Moczulski Date: Fri, 16 Jun 2017 05:28:37 -0700 Subject: [PATCH] instructions for CodeIgniter --- README.md | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a45f91a5..ca5b0b1c 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,30 @@ Rollbar::init($config, $set_exception_handler, $set_error_handler); ### For CodeIgniter Users -If you are using CodeIgniter and wish to report on E_NOTICE level errors you'll have to be sure to run `Rollbar::init` from inside the Controller constructor. +If you are using CodeIgniter you can place `Rollbar::init` in either of the two places: +* inside the Controller's constructor +```php + public function __construct() + { + Rollbar::init(array( + 'access_token' => config_item('rollbar_access_token'), + 'environment' => ENVIRONMENT + )); + parent::__construct(); + } +``` +* `pre_system` hook +```php +$hook['pre_system'] = function () { + Rollbar::init([ + 'access_token' => config_item('rollbar_access_token'), + 'environment' => ENVIRONMENT, + 'root' => APPPATH . '../' + ]); +}; +``` + +**Note: If you wish to log `E_NOTICE` errors make sure to pass `'included_errno' => E_ALL` to `Rollbar::init`.** ### For Heroku Users