add feature to debuglog: accept object as message, and convert object to string
This commit is contained in:
parent
733226d592
commit
cc31d76f99
|
@ -4,10 +4,16 @@ libxml_use_internal_errors(true);
|
|||
error_reporting(E_ALL);
|
||||
|
||||
function lassospkit_debuglog($msg, $level = 0) {
|
||||
if (! is_string($msg)) {
|
||||
$msg = var_export($msg, 1);
|
||||
}
|
||||
$lassospkit_debug_level = LassoSPKitConfig::get('debug');
|
||||
if ($level <= $lassospkit_debug_level) {
|
||||
openlog("LassoPHP.SP.Kit", LOG_PID, LOG_AUTHPRIV);
|
||||
syslog(LOG_DEBUG, $msg);
|
||||
$msgs = explode("\n",$msg);
|
||||
foreach ($msgs as $msg) {
|
||||
syslog(LOG_DEBUG, $msg);
|
||||
}
|
||||
closelog();
|
||||
}
|
||||
}
|
||||
|
|
Reference in New Issue