| 
<?php
/**
 * Example of how to use class.consoleLog.php by Shane Kretzmann
 */
 // turn on reporting of all errors but suppress the screen echo
 ini_set('display_errors',0); error_reporting(E_ALL);
 
 // start up the class (self initiating with object name: $console)
 require_once('class.consoleLog.php');
 // Once loaded all PHP Notices, Warnings, Errors and UnCaught Exceptions will automatically get logged
 // to the firebug console.
 
 
 $showInConsole = array( // build settings array for what we want to show up in console
 'log'            => true,
 'info'            => true,
 'debug'            => true,
 'warnings'        => true,
 'errors'        => true,
 'exceptions'    => true,
 );
 $console->settings($showInConsole); // This is optional, the class defaults to everything on
 
 // Various ways to push information to the firebug console
 $console->log('This is a Log to Console from PHP');
 $console->info('This is a Info push to Console from PHP');
 $console->debug('This is a debug push to Console from PHP');
 $console->warn('This is a Warning push to console from PHP');
 $console->error('This is a Error push to console from PHP');
 
 // This examples shows how you can pass an array thru to the console
 // You can also pass variables and objects in this manner.
 $array = array('test'=>'value of test','test2'=>'value of test2');
 $console->debug('Example of passing an array to console: Inside $array we have:',$array);
 
 
 echo 'Open your firebug console in order to see the results of this example file<br>';
 
 // here we force a PHP notice
 echo Enjoy;
 
 
 # The next two examples both cause the loading of the page to stop
 # To see each on you will need to uncomment the other :P
 
 // here we force a PHP Warning and Fatal Error
 require('invalid.php');
 
 // Now to show you how Exceptions are caught with this class and pushed to firebug console
 # throw new Exception('Just throwing it out there (exception example)');
 
 ?>
 |