logLevel = $logLevel; if($logLevel == L_OFF) { $this->logLevel = L_OFF; } else { if (!$this->errorLogFile = @fopen($errorLogFile, "a")) { header('HTTP/1.0 500 Internal Server Error'); $log = "Cannot open " . $errorLogFile . " file.\n" . "Logs are not writable, set them to 777"; error_log($log, 0); if($die) { die($log); }else { echo $log; $this->logLevel = L_OFF; } } if (!$this->messageLogFile = @fopen($messageLogFile, "a")) { fclose($this->errorLogFile); header('HTTP/1.0 500 Internal Server Error'); $log = "Cannot open " . $messageLogFile . " file.\n" . "Logs are not writable, set them to 777"; error_log($log, 0); if($die) { die($log); }else { echo $log; $this->logLevel = L_OFF; } } } $this->logLevel = $logLevel;; } function LogError($log){ if($this->logLevel & L_ERR){ fwrite($this->errorLogFile, sprintf("\n%s:- %s\n",date("D M j G:i:s T Y"),$log)); return true; } return false; } function LogRequest($log){ if($this->logLevel & L_RQST){ fwrite($this->messageLogFile, sprintf("\n%s:- %s\n",date("D M j G:i:s T Y"),$log)); return true; } return false; } function LogResponse($log) { if($this->logLevel & L_RESP){ $this->LogRequest($log); return true; } return false; } } ?>