Permalink
Browse files

Setup error path

  • Loading branch information...
zeentan committed Mar 6, 2012
1 parent 7d92537 commit 15acbcc0dcb7b5900f94cbfa802f9494195c5037
Showing with 17 additions and 13 deletions.
  1. +3 −0 Conf.php
  2. +14 −13 MysqlDB.php
View
@@ -19,6 +19,9 @@ class Conf{
const HTTP_UNAUTHORIZED = 401;
const HTTP_FORBIDDEN = 403;
const HTTP_NOTFOUND = 404;
+
+ // Define Log Path
+ const ERROR_LOG_PATH = '/tmp/error.log'
}
?>
View
@@ -7,19 +7,21 @@
private static $db_instance;
private $db_connection;
- private $db_host = '';
- private $db_user = '';
- private $db_pass = '';
- private $db_port = '';
- private $db_name = '';
+ private $db_host = '';
+ private $db_user = '';
+ private $db_pass = '';
+ private $db_port = '';
+ private $db_name = '';
+ private $error_log_path = '';
private function __construct(){
- $this->db_host = Conf::DB_HOST;
- $this->db_port = Conf::DB_PORT;
- $this->db_user = Conf::DB_USER;
- $this->db_pass = Conf::DB_PASS;
- $this->db_name = Conf::DB_NAME;
+ $this->db_host = Conf::DB_HOST;
+ $this->db_port = Conf::DB_PORT;
+ $this->db_user = Conf::DB_USER;
+ $this->db_pass = Conf::DB_PASS;
+ $this->db_name = Conf::DB_NAME;
+ $this->error_log_path = Conf::ERROR_LOG_PATH;
$this->db_connection = mysql_connect($this->db_host.(($this->db_port=='')?'':':'.$this->db_port), $this->db_user, $this->db_pass, false, 131072)
or die($this->LogError('Failure to connect to MySQL Database'));
@@ -57,7 +59,7 @@ public function SelectQuery($query){
}
$i++;
}
- return $res;
+ return $res;
}
if ($result && mysql_num_rows($result) == 0){
@@ -113,8 +115,7 @@ public function Sanitize($query){
}
public function LogError($message){
- echo "FATAL: $message<br>";
- error_log("FATAL:$message\n", 3, "/tmp/debug.log");
+ error_log("FATAL:$message\n", 3, $this->error_log_path);
}
}

0 comments on commit 15acbcc

Please sign in to comment.