From 3e28328dc9b064efc8a03000c82b4e05ac4148eb Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Fri, 18 Nov 2011 23:39:13 +1100 Subject: syslog() --- inc/functions.php | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'inc/functions.php') diff --git a/inc/functions.php b/inc/functions.php index 602b48ab..f9b16c8a 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -124,14 +124,24 @@ _textdomain('tinyboard'); } + + if($config['syslog']) + openlog('tinyboard', LOG_ODELAY, LOG_SYSLOG); // open a connection to sysem logger + if($config['recaptcha']) require_once 'inc/contrib/recaptcha/recaptchalib.php'; if($config['cache']['enabled']) require_once 'inc/cache.php'; } - function basic_error_function_because_the_other_isnt_loaded_yet($message) { - if(function_exists('sql_close')) sql_close(); + function basic_error_function_because_the_other_isnt_loaded_yet($message, $priority = true) { + global $config; + + if($config['syslog'] && $priority !== false) { + // Use LOG_NOTICE instead of LOG_ERR or LOG_WARNING because most error message are not significant. + _syslog($priority !== true ? $priority : LOG_NOTICE, $message); + } + // Yes, this is horrible. die('Error' . '