[20974] Improvement: Errorhandling - 4512:4565
Sigurd Nes <[email protected]> Fri, 22 Jan 2010 09:46:02 +0000
| Newsgroups | gmane.comp.web.phpgroupware.cvs |
|---|---|
| Message-ID | <[email protected]> |
Revision: 20974
http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=20974
Author: sigurdne
Date: 2010-01-22 09:46:02 +0000 (Fri, 22 Jan 2010)
Log Message:
-----------
Improvement: Errorhandling - 4512:4565
Modified Paths:
--------------
people/sigurdne/modules/phpgwapi/trunk/inc/class.log.inc.php
Modified: people/sigurdne/modules/phpgwapi/trunk/inc/class.log.inc.php
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/inc/class.log.inc.php 2010-01-22 09:44:29 UTC (rev 20973)
+++ people/sigurdne/modules/phpgwapi/trunk/inc/class.log.inc.php 2010-01-22 09:46:02 UTC (rev 20974)
@@ -47,7 +47,8 @@
'N' => 4,
'I' => 5,
'D' => 6,
- 'S' => 7
+ 'S' => 7,
+ 'DP'=>8
);
// these are used by the admin appliation when showing the log file.
@@ -60,7 +61,8 @@
'N' => 'notice',
'I' => 'info',
'D' => 'debug',
- 'S' => 'strict'
+ 'S' => 'strict',
+ 'DP'=> 'deprecated'
);
/**
@@ -186,6 +188,12 @@
return $this->log_if_level('S', $this->make_parms($arg_array));
}
+ function deprecated()
+ {
+ $arg_array = func_get_args();
+ return $this->log_if_level('DP', $this->make_parms($arg_array));
+ }
+
function warn()
{
$arg_array = func_get_args();
@@ -226,18 +234,23 @@
//trigger_error("Failed to log error to database: no database object available");
return;
}
- $db->query("insert into phpgw_log (log_date, log_app, log_account_id, log_account_lid, log_severity, log_file, log_line, log_msg) values "
- . "('" . date($db->datetime_format()) . "'"
- . ",'" . $db->db_addslashes($GLOBALS['phpgw_info']['flags']['currentapp']) . "'"
- . "," . ( isset($GLOBALS['phpgw_info']['user']['id']) ? $GLOBALS['phpgw_info']['user']['id'] : -1)
- . ",'" . $db->db_addslashes(isset($GLOBALS['phpgw_info']['user']['lid']) ? $GLOBALS['phpgw_info']['user']['lid'] : 'not authenticated') . "'"
- . ",'" . $err->severity . "'"
- . ",'" . $db->db_addslashes($err->fname) . "'"
- . "," . intval($err->line)
- . ",'" . $db->db_addslashes($err->msg) . "'"
- . ")"
- ,__LINE__,__FILE__
+
+ $values = array
+ (
+ date($db->datetime_format()),
+ $db->db_addslashes($GLOBALS['phpgw_info']['flags']['currentapp']),
+ isset($GLOBALS['phpgw_info']['user']['id']) && $GLOBALS['phpgw_info']['user']['id'] ? $GLOBALS['phpgw_info']['user']['id'] : -1,
+ $db->db_addslashes(isset($GLOBALS['phpgw_info']['user']['lid']) && $GLOBALS['phpgw_info']['user']['lid'] ? $GLOBALS['phpgw_info']['user']['lid'] : 'not authenticated'),
+ $err->severity,
+ $err->fname ? $db->db_addslashes($err->fname) : 'dummy',
+ (int)$err->line,
+ $db->db_addslashes($err->msg),
);
+
+ $values = $db->validate_insert($values);
+
+ $db->query("insert into phpgw_log (log_date, log_app, log_account_id, log_account_lid, log_severity,"
+ . "log_file, log_line, log_msg) values ({$values})",__LINE__,__FILE__);
if ( isset($db->Errno) )
{
//trigger_error("Failed to log error to database. DB errno " . $db->Errno . ": message " . $db->Error, E_USER_NOTICE);