Last active
December 14, 2017 16:06
-
-
Save lf-uraku-yuki/f18667242e6676de8fed289f1375305c to your computer and use it in GitHub Desktop.
CodeIgniter 3.x Logging Back Trace Helper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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