static function debug($message, $debug_type = N_DEBUGTYPE_INFO, $log_level = PEAR_LOG_DEBUG, $ident = false) { $debug_level = defined('DEBUG_LEVEL') ? constant('DEBUG_LEVEL') : 0; if (empty($debug_level) || is_numeric($debug_level) && $debug_level < $log_level) { return; } $debug_type_setting = defined('DEBUG_TYPE') ? constant('DEBUG_TYPE') : 0; if (empty($debug_type_setting) || !is_numeric($debug_type_setting) || !($debug_type_setting & $debug_type)) { return; } // make message intelligible if (!is_string($message)) { $message = print_r($message, true); } $filename = NDebug::getFilename($debug_type); if ($ident == false) { $ident = ucwords(APP_NAME); } $log = Log::singleton('file', NDebug::getDir() . $filename, $ident); $log->log($message, $log_level); unset($log); }