From ddd894dbe86c678076b51fc10a9ef8a655f29d68 Mon Sep 17 00:00:00 2001 From: alecpl <alec@alec.pl> Date: Fri, 19 Sep 2008 14:00:51 -0400 Subject: [PATCH] - small fix --- program/include/bugs.inc | 22 ++++++++++++++-------- 1 files changed, 14 insertions(+), 8 deletions(-) diff --git a/program/include/bugs.inc b/program/include/bugs.inc index 9d98ef4..f7a1fd5 100644 --- a/program/include/bugs.inc +++ b/program/include/bugs.inc @@ -66,26 +66,32 @@ */ function log_bug($arg_arr) { - global $CONFIG, $INSTALL_PATH; - $program = $arg_arr['type']=='xpath' ? 'XPath' : strtoupper($arg_arr['type']); + global $CONFIG; + $program = strtoupper($arg_arr['type']); // write error to local log file if ($CONFIG['debug_level'] & 1) { - $log_entry = sprintf( - "[%s] %s Error: %s in %s on line %d\n", + $log_entry = sprintf("[%s] %s Error: %s in %s on line %d (%s %s)\n", date("d-M-Y H:i:s O", mktime()), $program, $arg_arr['message'], $arg_arr['file'], - $arg_arr['line']); - + $arg_arr['line'], + $_SERVER['REQUEST_METHOD'], + $_SERVER['REQUEST_URI']); + if (empty($CONFIG['log_dir'])) - $CONFIG['log_dir'] = $INSTALL_PATH.'logs'; + $CONFIG['log_dir'] = INSTALL_PATH.'logs'; // try to open specific log file for writing - if ($fp = @fopen($CONFIG['log_dir'].'/errors', 'a')) + if ($CONFIG['log_driver'] == 'syslog') { + syslog(LOG_ERR, $log_entry); + } + else if ($fp = @fopen($CONFIG['log_dir'].'/errors', 'a')) + { + // log_driver == 'file' is the default, assumed here. fwrite($fp, $log_entry); fclose($fp); } -- Gitblit v1.9.1