/****f* util/log_message * NAME * log_message - Sends a string to syslog with specified priority. * INPUTS * $message - string containing the syslog message. * $priority - priority to send with, defaults to 'info' * RESULT * null ******/ function log_message($message, $priority = 'info') { global $g; $page = $_SERVER['SCRIPT_NAME']; if (empty($page)) { $files = get_included_files(); $page = basename($files[0]); } switch (strtolower($priority)) { case str_starts_with($priority, 'emerg'): $pri = LOG_EMERG; break; case 'alert': $pri = LOG_ALERT; break; case str_starts_with($priority, 'crit'): $pri = LOG_CRIT; break; case str_starts_with($priority, 'err'): $pri = LOG_ERR; break; case str_starts_with($priority, 'warn'): $pri = LOG_WARN; break; case 'notice': $pri = LOG_NOTICE; break; case str_starts_with($priority, 'debug'): $pri = LOG_DEBUG; break; default: $pri = LOG_INFO; break; } syslog($pri, "$page: $message"); if (g_get('debug')) { syslog(LOG_WARNING, var_export(debug_backtrace())); } return; }