本文整理匯總了PHP中LoggerManager::fatal方法的典型用法代碼示例。如果您正苦於以下問題:PHP LoggerManager::fatal方法的具體用法?PHP LoggerManager::fatal怎麽用?PHP LoggerManager::fatal使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類LoggerManager
的用法示例。
在下文中一共展示了LoggerManager::fatal方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: reportException
protected function reportException($message, $e)
{
$this->logger->fatal("{$message}: " . get_class($e));
if ($this->logger->wouldLog('error')) {
$this->logger->error($e->getMessage());
}
}
示例2: parseSQL
/**
* Parse SQL with types from sql in the form of "INSERT INTO testPreparedStatement(id, name) VALUES(?int, ?varchar)"
* @param string $sql
* @param array $lobs names of clob and blob fields from query
* @return boolean
*/
protected function parseSQL($sql, array $lobs = array())
{
if (empty($this->DBM)) {
$this->log->error("Prepare failed: Database object missing");
return false;
}
if (empty($sql)) {
$this->log->error("Prepare failed: empty SQL statement");
return false;
}
$this->sqlText = $sql;
$this->log->info("Parse Query: {$sql}");
// Build fieldDefs array and replace ?SugarDataType placeholders with a single ?placeholder
$cleanedSql = "";
$nextParam = strpos($sql, "?");
if ($nextParam == 0) {
$cleanedSql = $sql;
} else {
// parse the sql string looking for params
$row = 0;
while ($nextParam > 0) {
$cleanedSql .= substr($sql, 0, $nextParam + 1);
// we want the ?
$sql = substr($sql, $nextParam + 1);
// strip leading chars
// scan for termination of SugarDataType
$sugarDataType = "";
for ($i = 0; $i < strlen($sql) and strpos(",) ", substr($sql, $i, 1)) === false; $i++) {
if (strpos(",) ", substr($sql, $i, 1)) == false) {
$sugarDataType .= substr($sql, $i, 1);
}
}
if ($sugarDataType === "") {
// no type, default to varchar
$sugarDataType = 'varchar';
}
// insert the fieldDef
$this->fieldDefs[$row]['type'] = $sugarDataType;
if ($this->DBM->isTextType($sugarDataType)) {
if (empty($lobs)) {
$this->log->fatal('Name of lob field is not specified: ' . $this->sqlText);
return false;
}
$this->lobFields[$row] = array_shift($lobs);
}
$sql = substr($sql, $i);
// strip off the SugarDataType
$nextParam = strpos($sql, "?");
// look for another param
$row++;
}
// add the remaining sql
$cleanedSql .= $sql;
}
$this->parsedSQL = $cleanedSql;
return true;
}