add feature to debuglog: accept object as message, and convert object to string

This commit is contained in:
<bdauvergne@entrouvert.com> 1209574276 +0200 0001-01-01 00:00:00 +00:00
parent 733226d592
commit cc31d76f99
1 changed files with 7 additions and 1 deletions

View File

@ -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();
}
}