本文整理汇总了PHP中Prado::log方法的典型用法代码示例。如果您正苦于以下问题:PHP Prado::log方法的具体用法?PHP Prado::log怎么用?PHP Prado::log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Prado
的用法示例。
在下文中一共展示了Prado::log方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rollback
/**
* Rolls back a transaction.
* @throws TDbException if the transaction or the DB connection is not active.
*/
public function rollback()
{
if ($this->_compatible) {
$this->getConnection()->setForceMaster(TMasterSlaveDbConnectionForceMaster::OFF_AUTOMATIC);
}
Prado::log('rollback, ForceMaster: OFF_AUTOMATIC', TLogger::DEBUG, 'System.Testing.Data.Distributed.MasterSlave.TMasterSlaveDbTransaction');
parent::rollback();
}
示例2: handleExternalError
/**
* Handles external error caused by end-users.
* This method overrides the parent implementation.
* It is invoked by PRADO when an external exception is thrown.
*/
protected function handleExternalError($statusCode, $exception)
{
// log the error (only for BlogException)
if ($exception instanceof BlogException) {
Prado::log($exception->getErrorMessage(), TLogger::ERROR, 'BlogApplication');
}
// call parent implementation to display the error
parent::handleExternalError($statusCode, $exception);
}
示例3: handleExternalError
/**
* Displays error to the client user.
* THttpException and errors happened when the application is in <b>Debug</b>
* mode will be displayed to the client user.
* @param integer response status code
* @param Exception exception instance
*/
protected function handleExternalError($statusCode, $exception)
{
if ($exception instanceof BlogException) {
$message = $exception->getMessage();
Prado::log($message, TLogger::ERROR, 'BlogApplication');
$message = urldecode($this->getApplication()->getSecurityManager()->hashData($message));
$this->Response->redirect($this->Service->constructUrl('ErrorReport', array('msg' => $message), false));
} else {
parent::handleExternalError($statusCode, $exception);
}
}
示例4: onError
public function onError($param)
{
Prado::log($param->getMessage(), TLogger::ERROR, 'System.TApplication');
$this->raiseEvent('OnError', $this, $param);
$this->getErrorHandler()->handleError($this, $param);
}
示例5: queryInternal
/**
* @param string method of PDOStatement to be called
* @param mixed the first parameter to be passed to the method
* @return mixed the method execution result
*/
private function queryInternal($method, $mode)
{
$params = $this->_connection->enableParamLogging && !empty($this->_params) ? '. Bind with parameter ' . implode(', ', $this->_params) : '';
Prado::trace('Querying SQL: ' . $this->getText() . $params, 'System.Testing.Data.TDbCommand');
try {
/*
if($this->_connection->enableProfiling)
Prado::beginProfile('System.Testing.Data.TDbCommand.query('.$this->getText().')','System.Testing.Data.TDbCommand.query');
*/
if ($this->_statement instanceof PDOStatement) {
$this->_statement->execute();
} else {
$this->_statement = $this->getConnection()->getPdoInstance()->query($this->getText());
}
if ($method === '') {
$result = new TDbDataReader($this);
} else {
$result = $this->_statement->{$method}($mode);
$this->_statement->closeCursor();
}
/*
if($this->_connection->enableProfiling)
Prado::endProfile('System.Testing.Data.TDbCommand.query('.$this->getText().')','System.Testing.Data.TDbCommand.query');
*/
return $result;
} catch (Exception $e) {
/*
if($this->_connection->enableProfiling)
prado::endProfile('System.Testing.Data.TDbCommand.query('.$this->getText().')','System.Testing.Data.TDbCommand.query');
*/
Prado::log('Error in querying SQL: ' . $this->getText() . $params, TLogger::ERROR, 'System.Testing.Data..TDbCommand');
throw new TDbException('TDbCommand failed to execute the SQL statement: {0}', $e->getMessage());
}
}
示例6: __construct
/**
* Constructor.
* @param TDbConnection the database connection
* @param string the SQL statement to be executed
* @param TDbStatementClassification Defaults to 'UNKNOWN'
*/
public function __construct(TDbConnection $connection, $text, $classification = TDbStatementClassification::UNKNOWN)
{
$connection->setActive(true);
parent::__construct($connection, $text);
$this->_statementClassification = $classification;
Prado::log($classification . ', ' . $connection->getServerRole() . ': ' . preg_replace('/[\\s]+/', ' ', $text), TLogger::DEBUG, 'System.Testing.Data.Distributed.TDistributedDbCommand');
}
示例7: createCommand
/**
* Creates a command for execution.
* @param string SQL statement associated with the new command.
* @return TDistributedDbCommand the DB command
* @throws TDbException if the connection is not active
*/
public function createCommand($sql)
{
$force = $this->getForceMaster();
if ($force == TMasterSlaveDbConnectionForceMaster::ON_MANUAL || $force == TMasterSlaveDbConnectionForceMaster::ON_TRANSACTION) {
Prado::log('ForceMaster: ' . $force, TLogger::DEBUG, 'System.Testing.Data.Distributed.MasterSlave.TSlaveDbConnection');
return new TDistributedDbCommand($this->getMasterConnection(), $sql, TDbStatementClassification::UNKNOWN);
}
$bEnqueue = false;
$bMaster = false;
$classification = $this->getStatementClassification($sql);
switch ($classification) {
case TDbStatementClassification::SQL:
$bMaster = false;
break;
case TDbStatementClassification::CONTEXT:
$bEnqueue = true;
$bMaster = true;
break;
case TDbStatementClassification::TCL:
$this->setForceMaster(TMasterSlaveDbConnectionForceMaster::ON_TCL);
case TDbStatementClassification::DDL:
case TDbStatementClassification::DML:
case TDbStatementClassification::DCL:
case TDbStatementClassification::UNKNOWN:
default:
$bMaster = true;
break;
}
$bMaster = $bMaster || $this->getForceMaster();
$result = new TDistributedDbCommand($bMaster ? $this->getMasterConnection() : $this, $sql, $classification);
if ($bEnqueue) {
$this->getMasterConnection()->getStatementQueue()->enqueue($result);
}
return $result;
}