CodeIgniter 3.x Logging Back Trace Helper
<?php | |
if (! function_exist('logDebug')) { | |
function logDebug($message) | |
{ | |
$trace = debug_backtrace(); | |
$output = 'UserLog: ' . $trace[1]["class"] . '::' . $trace[1]['function'] . ' - '; | |
if (is_array($message)) { | |
$message = print_r($message, true); | |
} | |
$output .= $message; | |
log_message('debug', $output); | |
} | |
} | |
if (! function_exists('logError')) { | |
function logError($message) | |
{ | |
$trace = debug_backtrace(); | |
$output = 'UserLog: ' . $trace[1]["class"] . '::' . $trace[1]['function'] . ' - '; | |
if (is_array($message)) { | |
$message = print_r($message, true); | |
} | |
$output .= $message; | |
log_message('error', $output); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment