本文整理匯總了PHP中Zend_Log::zflog方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Log::zflog方法的具體用法?PHP Zend_Log::zflog怎麽用?PHP Zend_Log::zflog使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend_Log
的用法示例。
在下文中一共展示了Zend_Log::zflog方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: mark
/**
* Sets a time mark identified with $name
*
* @param string $name
* @param bool $logFirst
*/
public function mark($name, $logFirst = false)
{
if (isset($this->marks[$name])) {
$this->marks[$name]['time'] = round((microtime(true) - $_SERVER['REQUEST_TIME']) * 1000 - $this->marks[$name]['time']) . 'ms';
if (function_exists('memory_get_usage')) {
$this->marks[$name]['memory'] = round((memory_get_usage() - $this->marks[$name]['memory']) / 1024) . 'K';
} else {
$this->marks[$name]['memory'] = 'N/A';
}
$this->logger->zflog(['time' => $this->marks[$name]['time'], 'memory' => $this->marks[$name]['memory'], 'message' => $name]);
} else {
$this->marks[$name]['time'] = (microtime(true) - $_SERVER['REQUEST_TIME']) * 1000;
if (function_exists('memory_get_usage')) {
$this->marks[$name]['memory'] = memory_get_usage();
} else {
$this->marks[$name]['memory'] = 'N/A';
}
if ($logFirst) {
$this->logger->zflog(['time' => round($this->marks[$name]['time']) . 'ms', 'memory' => round($this->marks[$name]['memory'] / 1024) . 'K', 'message' => $name]);
}
}
}