[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] phpgwapi/inc class.log.inc.php class.log_messag...
From: |
Dave Hall |
Subject: |
[Phpgroupware-cvs] phpgwapi/inc class.log.inc.php class.log_messag... |
Date: |
Mon, 25 Sep 2006 06:27:35 +0000 |
CVSROOT: /cvsroot/phpgwapi
Module name: phpgwapi
Changes by: Dave Hall <skwashd> 06/09/25 06:27:35
Modified files:
inc : class.log.inc.php class.log_message.inc.php
Log message:
fix severity and filename and improve fatal error output
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.log.inc.php?cvsroot=phpgwapi&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.log_message.inc.php?cvsroot=phpgwapi&r1=1.4&r2=1.5
Patches:
Index: class.log.inc.php
===================================================================
RCS file: /cvsroot/phpgwapi/phpgwapi/inc/class.log.inc.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- class.log.inc.php 19 Sep 2006 15:16:42 -0000 1.12
+++ class.log.inc.php 25 Sep 2006 06:27:34 -0000 1.13
@@ -7,7 +7,7 @@
* @license http://www.fsf.org/licenses/gpl.html GNU General Public
License
* @package phpgwapi
* @subpackage application
- * @version $Id: class.log.inc.php,v 1.12 2006/09/19 15:16:42 skwashd
Exp $
+ * @version $Id: class.log.inc.php,v 1.13 2006/09/25 06:27:34 skwashd
Exp $
*/
/**
@@ -23,7 +23,8 @@
* Instance Variables... *
\***************************/
var $errorstack = array();
- var $public_functions = array(
+ var $public_functions = array
+ (
'debug',
'info',
'notice',
@@ -105,7 +106,7 @@
{
if ( $this->is_level($level) )
{
- $parms['severity']=$level;
+ $parms['severity'] = $level;
$err =
createObject('phpgwapi.log_message',$parms);
$this->write_error_to_db($err);
$this->handle_fatal_error($err);
// this is here instead of in fatal() because I still support
@@ -215,36 +216,27 @@
{
if ($err->severity == 'F')
{
- // This is it... Don't return
- // do rollback!
- // Hmmm this only works if UI!!!!
- // What Do we do if it's a SOAP/XML?
- echo "<Center>";
- echo "<h1>Fatal Error</h1>";
- echo "<center>\n";
- echo "<table width=\"98%\">\n";
- echo "\t<tr bgcolor=\"D3DCFF\">\n";
- echo "\t\t<td width=\"16%\">Date</td>\n";
- echo "\t\t<td width=\"15%\">App</td>\n";
- echo "\t\t<td align=\"center\",
width=\"2%\">S</td>\n";
- echo "\t\t<td >Msg</td>\n";
- echo "\t\t<td >File</td>\n";
- echo "\t\t<td >Line</td>\n";
- echo "\t</tr>\n";
-
- echo "\t<tr bgcolor=".'"'.'FF0909'.'"'.">\n";
- echo
"\t\t<td>".$GLOBALS['phpgw']->common->show_date($err->timestamp)."</td>\n";
- echo "\t\t<td>".$err->app."  </td>\n";
- echo "\t\t<td
align=center>".$err->severity."</td>\n";
- echo "\t\t<td>".$err->msg."</td>\n";
- echo "\t\t<td>".$err->fname."</td>\n";
- echo "\t\t<td>".$err->line."</td>\n";
- echo "\t</tr>\n";
-
- echo "</table>\n";
- echo "</center>\n";
+ $trace = '<p>' . lang('Please report this
incident to your system administrator') . "</p>\n";
+ $msg = $err->msg;
+ if ( strpos($err->msg, "\n") )
+ {
+ $msg_array = explode("\n", $err->msg);
+ $msg = $msg_array[0];
+ unset($msg_array[0]);
+ if (
isset($GLOBALS['phpgw_info']['user']['apps']['admin']) )
+ {
+ $trace = '<h2>' .lang('back
trace') . "</h2>\n"
+ . '<p>'
. lang('Please include the following output when you report this incident on
our bug tracker - %1',
+
'<a href="https://savannah.gnu.org/bugs/?group=phpgroupware"
target="_blank">https://savannah.gnu.org/bugs/?group=phpgroupware</a>') .
"</p>\n"
+ .
'<pre>' . implode("\n", $msg_array) . '</pre>';
+ }
+ }
- echo "</center>";
+ echo '<h1>' . lang('Fatal Error') . "</h1>\n"
+ . "<h2>{$msg}</h2>\n"
+ . '<p>' . lang('file') . ': ' .
$err->fname . "<br>\n"
+ . lang('line') . ': ' . $err->line .
"</p>\n"
+ . $trace;
$GLOBALS['phpgw']->common->phpgw_exit(True);
}
Index: class.log_message.inc.php
===================================================================
RCS file: /cvsroot/phpgwapi/phpgwapi/inc/class.log_message.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- class.log_message.inc.php 19 Sep 2006 15:16:42 -0000 1.4
+++ class.log_message.inc.php 25 Sep 2006 06:27:34 -0000 1.5
@@ -7,7 +7,7 @@
* @license http://www.fsf.org/licenses/gpl.html GNU General Public
License
* @package phpgwapi
* @subpackage application
- * @version $Id: class.log_message.inc.php,v 1.4 2006/09/19 15:16:42
skwashd Exp $
+ * @version $Id: class.log_message.inc.php,v 1.5 2006/09/25 06:27:34
skwashd Exp $
*/
/**
@@ -51,23 +51,15 @@
// This code is left in for backward compatibility with
the
// old log code. Consider it deprecated.
- if (eregi('([DIWEF])-([[:alnum:]]*)\,
(.*)',$etext,$match))
+ if ( !isset( $parms['severity']) &&
eregi('([DIWEF])-([[:alnum:]]*)\, (.*)',$etext,$match))
{
$this->severity = strtoupper($match[1]);
$this->msg = trim($match[3]);
}
else
{
- $this->msg = trim($etext);
- }
-
- // If I was going to use translations for log messages,
I'd probably put it here.
-
- // DWD - override the severity in the message with that
provided in the parms.
- // Eventually, the old logging will go away and the
above code can be removed.
- if ( isset($params['severity']) && $params['severity']
)
- {
$this->severity = $parms['severity'];
+ $this->msg = trim($etext);
}
foreach ( $parray as $key => $val )
@@ -84,8 +76,7 @@
}
if ( isset($parms['file']) )
{
- // DWD - May want to change the "remove the
server root" thing to a configuration option
- $this->fname = substr($parms['file'],
strlen(PHPGW_SERVER_ROOT) + 1);
+ $this->fname = str_replace(PHPGW_SERVER_ROOT,
'/path/to/phpgroupware', $parms['file']);
}
if ( isset(
$GLOBALS['phpgw_info']['flags']['currentapp']) )
{