/** * Logs exception and return false to mark operation has failed. * @param string $message A message to write into log * @return false */ protected function throwException($message = '') { if ($this->_log === null) { $this->_log = new LogWriter($this->_logPath); } if (mysqli_connect_errno()) { $message = '(' . mysqli_connect_errno() . ') ' . mysqli_connect_error() . ': ' . $message; } elseif (mysqli_errno($this->_conn)) { $message = '(' . mysqli_errno($this->_conn) . ') ' . mysqli_error($this->_conn) . ': ' . $message; } if ($message) { $this->_log->log($message); } return false; }
/** * Logs exception and return false to mark operation has failed. * @param string $message A message to write into log * @param Exception $exc The exception occurs while executing the function * @param array $params An array of parameters passed to the 'mail' function (to, subject, message, header) * @return false */ protected function throwException($message = '', $exc = null, $params = array()) { if ($this->_log === null) { $this->_log = new LogWriter(realpath(dirname(__FILE__) . '/../logs') . DIRECTORY_SEPARATOR . 'mail.log'); } if ($exc) { $message = '(' . $exc->getCode() . ') ' . $exc->getMessage() . ': ' . $message; } foreach ($params as $pName => $pValue) { $message .= PHP_EOL . $pName . ': ' . $pValue; } if ($message) { $this->_log->log($message); } return false; }