From 9debfa348aada8ad32a16cbba4f96cc8f4b0ac37 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 7 Mar 2016 20:43:52 -0800 Subject: add syslog loglevels to dba functions --- include/dba/dba_driver.php | 8 ++++---- include/dba/dba_mysqli.php | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'include/dba') diff --git a/include/dba/dba_driver.php b/include/dba/dba_driver.php index 2219b43cb..3c5b0b67e 100755 --- a/include/dba/dba_driver.php +++ b/include/dba/dba_driver.php @@ -303,9 +303,9 @@ function q($sql) { if($stmt === false) { if(version_compare(PHP_VERSION, '5.4.0') >= 0) logger('dba: vsprintf error: ' . - print_r(debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 1), true)); + print_r(debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 1), true),LOGGER_NORMAL,LOG_CRIT); else - logger('dba: vsprintf error: ' . print_r(debug_backtrace(), true)); + logger('dba: vsprintf error: ' . print_r(debug_backtrace(), true),LOGGER_NORMAL,LOG_CRIT); } return $db->q($stmt); } @@ -314,7 +314,7 @@ function q($sql) { * This will happen occasionally trying to store the * session data after abnormal program termination */ - logger('dba: no database: ' . print_r($args,true)); + logger('dba: no database: ' . print_r($args,true),LOGGER_NORMAL,LOG_CRIT); return false; } @@ -385,7 +385,7 @@ function db_getfunc($f) { if(isset($lookup[$f]) && isset($lookup[$f][ACTIVE_DBTYPE])) return $lookup[$f][ACTIVE_DBTYPE]; - logger('Unable to abstract DB function "'. $f . '" for dbtype ' . ACTIVE_DBTYPE, LOGGER_DEBUG); + logger('Unable to abstract DB function "'. $f . '" for dbtype ' . ACTIVE_DBTYPE, LOGGER_DEBUG, LOG_ERR); return $f; } diff --git a/include/dba/dba_mysqli.php b/include/dba/dba_mysqli.php index 74a999974..6986d4586 100755 --- a/include/dba/dba_mysqli.php +++ b/include/dba/dba_mysqli.php @@ -32,7 +32,7 @@ class dba_mysqli extends dba_driver { if($this->error) { - logger('dba_mysqli: ERROR: ' . printable($sql) . "\n" . $this->error); + logger('dba_mysqli: ERROR: ' . printable($sql) . "\n" . $this->error, LOGGER_NORMAL, LOG_ERR); if(file_exists('dbfail.out')) { file_put_contents('dbfail.out', datetime_convert() . "\n" . printable($sql) . "\n" . $this->error . "\n", FILE_APPEND); } @@ -40,13 +40,13 @@ class dba_mysqli extends dba_driver { if(($result === true) || ($result === false)) { if($this->debug) { - logger('dba_mysqli: DEBUG: ' . printable($sql) . ' returns ' . (($result) ? 'true' : 'false')); + logger('dba_mysqli: DEBUG: ' . printable($sql) . ' returns ' . (($result) ? 'true' : 'false'), LOGGER_NORMAL,(($result) ? LOG_INFO : LOG_ERR)); } return $result; } if($this->debug) { - logger('dba_mysqli: DEBUG: ' . printable($sql) . ' returned ' . $result->num_rows . ' results.'); + logger('dba_mysqli: DEBUG: ' . printable($sql) . ' returned ' . $result->num_rows . ' results.', LOGGER_NORMAL, LOG_INFO); } $r = array(); @@ -55,7 +55,7 @@ class dba_mysqli extends dba_driver { $r[] = $x; $result->free_result(); if($this->debug) { - logger('dba_mysqli: ' . printable(print_r($r,true))); + logger('dba_mysqli: ' . printable(print_r($r,true)), LOGGER_NORMAL, LOG_INFO); } } return $r; -- cgit v1.2.3