本文整理汇总了PHP中zend_monitor_custom_event函数的典型用法代码示例。如果您正苦于以下问题:PHP zend_monitor_custom_event函数的具体用法?PHP zend_monitor_custom_event怎么用?PHP zend_monitor_custom_event使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了zend_monitor_custom_event函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
public function indexAction()
{
$params = ZendJobQueue::getCurrentJobParams();
if (isset($params['obj'])) {
$obj = unserialize(base64_decode($params['obj']));
if ($obj instanceof ZendServer_JobQueue_Job_Abstract) {
try {
$obj->run();
ZendJobQueue::setCurrentJobStatus(ZendJobQueue::OK);
exit;
} catch (Exception $e) {
zend_monitor_set_aggregation_hint(get_class($obj) . ': ' . $e->getMessage());
zend_monitor_custom_event('Failed Job', $e->getMessage());
}
}
}
ZendJobQueue::setCurrentJobStatus(ZendJobQueue::FAILED);
exit;
}
示例2: doWrite
/**
* Write a message to the log.
*
* @param array $event log data event
* @return void
*/
protected function doWrite(array $event)
{
$priority = $event['priority'];
$message = $event['message'];
unset($event['priority'], $event['message']);
if (!empty($event)) {
if ($this->isZendServer) {
// On Zend Server; third argument should be the event
zend_monitor_custom_event($priority, $message, $event);
} else {
// On Zend Platform; third argument is severity -- either
// 0 or 1 -- and fourth is optional (event)
// Severity is either 0 (normal) or 1 (severe); classifying
// notice, info, and debug as "normal", and all others as
// "severe"
monitor_custom_event($priority, $message, $priority > 4 ? 0 : 1, $event);
}
} else {
monitor_custom_event($priority, $message);
}
}
示例3: writeZendMonitorCustomEvent
/**
* Write a record to Zend Monitor
*
* @param int $level
* @param string $message
* @param array $formatted
*/
protected function writeZendMonitorCustomEvent($level, $message, $formatted)
{
zend_monitor_custom_event($level, $message, $formatted);
}
示例4: createCustomEvent
/**
* Create a custom event in Zend Server
*
* @param MvcEvent $e
* @return void
*/
public function createCustomEvent(MvcEvent $e)
{
// Do nothing if no error in the event
$error = $e->getError();
if (empty($error)) {
return;
}
// Do nothing if the result is a response object
$result = $e->getResult();
if ($result instanceof Response) {
return;
}
switch ($error) {
case Application::ERROR_CONTROLLER_NOT_FOUND:
case Application::ERROR_CONTROLLER_INVALID:
case Application::ERROR_ROUTER_NO_MATCH:
// Specifically not handling these
return;
case Application::ERROR_EXCEPTION:
default:
if (!empty($e)) {
$exception = $e->getParam('exception');
/* @var $exception \Exception */
$message = 'An error occurred during execution: ' . $exception->getMessage();
if ($this->isCustomEventByRuleIsEnabled()) {
zend_monitor_custom_event_ex('Zend Framework Exception', $message, 'Zend Framework Exception Rule');
} elseif ($this->isCustomEventIsEnabled) {
zend_monitor_custom_event('Zend Framework Exception', $message);
}
}
}
}