application/hooks/custom_log.php
// Name of function same as mentioned in Hooks Config
Name of function same as mentioned in Hooks Config
Name of function same as mentioned in Hooks Config
function logMessages() {
		$CI = & get_instance();
		if (!empty($CI->custom_log_messages)){
			$userName = '';
			if (!empty(config_item('auth_email'))){
				$userName = config_item('auth_email') . ' - ';
			}
			$filepath = APPPATH . 'logs/'. $userName . date('Y-m-d') . '.php'; 
			$handle = fopen($filepath, "a+");                 
			flock($handle,LOCK_EX);
			$custom_log_messages = $CI->custom_log_messages;                   
			foreach ($CI->custom_log_messages as $msg) { 
				fwrite($handle, $msg . "\n\n");              
			}
			flock($handle,LOCK_UN);
			fclose($handle);      
		}
    }
function logMessages ( ) { $ CI = & get_instance ( ) ; if ( ! empty ( $ CI -> custom_log_messages ) ) { $ userName = '' ; if ( ! empty ( config_item ( 'auth_email' ) ) ) { $ userName = config_item ( 'auth_email' ) . ' - ' ; } $ filepath = APPPATH . 'logs/' . $ userName . date ( 'Y-m-d' ) . '.php' ; $ handle = fopen ( $ filepath , " a+ " ) ; flock ( $ handle , LOCK_EX ) ; $ custom_log_messages = $ CI -> custom_log_messages ; foreach ( $ CI -> custom_log_messages as $ msg ) { fwrite ( $ handle , $ msg . " \n \n " ) ; } flock ( $ handle , LOCK_UN ) ; fclose ( $ handle ) ; } }
Name of function same as mentioned in Hooks Config
Name of function same as mentioned in Hooks Config
//echo 'Yes'; // Creating Query Log file with today's date in application/logs folder // Opening file with pointer at the end of the file // Get execution time of all the queries executed by controller //echo $query; // Writing it in the log file // Close the file