protected function log($time, $message, $logLevel, $logGroup, $ip, $file, $line, $type = null) { if ($message == "") { return; } $timeString = strftime("Y-m-d H:i:s", $time); $userId = null; try { $userId = Gpf_Session::getAuthUser()->getUserId(); } catch (Gpf_Exception $e) { } try { $dbLog = new Gpf_Db_Log(); $dbLog->set('groupid', $logGroup); $dbLog->set('level', $logLevel); $dbLog->set('created', $timeString); $dbLog->set('filename', $file); $dbLog->set('message', $message); $dbLog->set('line', $line); $dbLog->set('ip', $ip); $dbLog->set('accountuserid', $userId); $dbLog->set(Gpf_Db_Table_Logs::TYPE, $type); $dbLog->save(); } catch (Exception $e) { Gpf_Log::disableType(Gpf_Log_LoggerDatabase::TYPE); Gpf_Log::error($this->_sys("Database Logger Error. Logging on display: %s", $message)); Gpf_Log::enableAllTypes(); } }
private function handleError($sth) { if ($sth->getErrorCode() == self::CR_SERVER_GONE_ERROR) { Gpf_Log::disableType(Gpf_Log_LoggerDatabase::TYPE); Gpf_Log::info($this->_sys('MySql server has gone away: Reconnecting...')); Gpf_Log::enableAllTypes(); throw new Gpf_DbEngine_ConnectionGoneException($this->_sys('MySql server has gone away.')); } Gpf_Log_Benchmark::end(self::BENCHMARK_EXECUTE, "SQL ERROR: " . $sth->getStatement()); $this->resetFailedConnectionsCount(); throw new Gpf_DbEngine_Driver_Mysql_SqlException($sth->getStatement(), $sth->getErrorMessage(), $sth->getErrorCode()); }
public function getList() { try { return $this->transactionList->getHtml(10); } catch (Exception $e) { if (Gpf_Log::isLogToDisplay()) { Gpf_Log::critical('Report list, getHtml exception: ' . $e->getMessage()); } else { Gpf_Log::addLogger(Gpf_Log_LoggerDisplay::TYPE, Gpf_Log::CRITICAL); Gpf_Log::critical('Report list, getHtml exception: ' . $e->getMessage()); Gpf_Log::disableType(Gpf_Log_LoggerDisplay::TYPE); } throw $e; } }
protected function logException() { Gpf_Log::disableType(Gpf_Log_LoggerDatabase::TYPE); Gpf_Log::error($this->getMessage()); Gpf_Log::enableAllTypes(); }