[eluser]nZac[/eluser]
Okay, I confess the title is a little bit misleading because what I am about to share is not revolutionary by any means, but tonight I was looking through my log files and realized they all seem to mesh together and there is no way to differentiate between executions without looking at time, or searching for that first 'Config Class Initialized' line. Therefore I added a post_system hook to display an 'END OF EXECUTION' line after every system run. Here is the code and steps to do it. (Nothing crazy, I know just thought I would share it)
Steps:
1. Turn on hooks if they are not already on (config.php around line 94 or search for 'enable_hooks')
2. In your application open the 'hooks' folder and create a new file (I called mine 'utilities')
3. Put the following code in that file:
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
function addLogBreak()
{
// If you want this to only show up when debuging, change 'info' to 'debug'
log_message('info' , '--------END OF EXECUTION----------');
}
4. Close that file
5. Navigate to and open application/config/hooks.php
6. Add this:
Code:
$hook['post_system'][] = array(
'class' => '',
'function' => 'addLogBreak',
'filename' => 'utilities.php', // NAME OF THE FILE YOU JUST CREATED
'filepath' => 'hooks',
'params' => array()
);
Thats it, when you run the system now your log should look like this:
Quote:DEBUG - 2011-07-09 00:18:17 --> Final output sent to browser
DEBUG - 2011-07-09 00:18:17 --> Total execution time: 0.0242
INFO - 2011-07-09 00:18:17 --> --------END OF EXECUTION----------
DEBUG - 2011-07-09 00:18:48 --> Config Class Initialized
DEBUG - 2011-07-09 00:18:48 --> Hooks Class Initialized
DEBUG - 2011-07-09 00:18:48 --> Utf8 Class Initialized
DEBUG - 2011-07-09 00:18:48 --> UTF-8 Support Enabled
DEBUG - 2011-07-09 00:18:48 --> URI Class Initialized
DEBUG - 2011-07-09 00:18:48 --> Router Class Initialized
DEBUG - 2011-07-09 00:18:48 --> Output Class Initialized
DEBUG - 2011-07-09 00:18:48 --> Security Class Initialized
DEBUG - 2011-07-09 00:18:48 --> Input Class Initialized
DEBUG - 2011-07-09 00:18:48 --> XSS Filtering completed
DEBUG - 2011-07-09 00:18:48 --> XSS Filtering completed
DEBUG - 2011-07-09 00:18:48 --> XSS Filtering completed
DEBUG - 2011-07-09 00:18:48 --> CRSF cookie Set
DEBUG - 2011-07-09 00:18:48 --> Global POST and COOKIE data sanitized
DEBUG - 2011-07-09 00:18:48 --> Language Class Initialized
DEBUG - 2011-07-09 00:18:48 --> Loader Class Initialized
DEBUG - 2011-07-09 00:18:48 --> Helper loaded: url_helper
DEBUG - 2011-07-09 00:18:48 --> Database Driver Class Initialized
DEBUG - 2011-07-09 00:18:48 --> Session Class Initialized
DEBUG - 2011-07-09 00:18:48 --> Helper loaded: string_helper
DEBUG - 2011-07-09 00:18:48 --> Encrypt Class Initialized
DEBUG - 2011-07-09 00:18:48 --> Session routines successfully run
DEBUG - 2011-07-09 00:18:48 --> Controller Class Initialized
DEBUG - 2011-07-09 00:18:48 --> Final output sent to browser
DEBUG - 2011-07-09 00:18:48 --> Total execution time: 0.1848
INFO - 2011-07-09 00:18:48 --> --------END OF EXECUTION----------
Any thoughts on how to add this as a standard feature (maybe not a hook) would be great conversation!