当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Log::registerErrorHandler方法代码示例

本文整理汇总了PHP中Zend_Log::registerErrorHandler方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Log::registerErrorHandler方法的具体用法?PHP Zend_Log::registerErrorHandler怎么用?PHP Zend_Log::registerErrorHandler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Log的用法示例。


在下文中一共展示了Zend_Log::registerErrorHandler方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testUsingWithErrorHandler

 /**
  * @group ZF-9192
  */
 public function testUsingWithErrorHandler()
 {
     $writer = new Zend_Log_Writer_Mock();
     $logger = new Zend_Log();
     $logger->addWriter($writer);
     $this->errWriter = $writer;
     $oldErrorLevel = error_reporting();
     $this->expectingLogging = true;
     error_reporting(E_ALL | E_STRICT);
     $oldHandler = set_error_handler(array($this, 'verifyHandlerData'));
     $logger->registerErrorHandler();
     trigger_error("Testing notice shows up in logs", E_USER_NOTICE);
     trigger_error("Testing warning shows up in logs", E_USER_WARNING);
     trigger_error("Testing error shows up in logs", E_USER_ERROR);
     $this->expectingLogging = false;
     error_reporting(0);
     trigger_error("Testing notice misses logs", E_USER_NOTICE);
     trigger_error("Testing warning misses logs", E_USER_WARNING);
     trigger_error("Testing error misses logs", E_USER_ERROR);
     restore_error_handler();
     // Pop off the Logger
     restore_error_handler();
     // Pop off the verifyHandlerData
     error_reporting($oldErrorLevel);
     // Restore original reporting level
     unset($this->errWriter);
 }
开发者ID:crodriguezn,项目名称:crossfit-milagro,代码行数:30,代码来源:LogTest.php

示例2: registerErrorHandler

 /**
  * Register Logging system as an error handler to log php errors
  * Register AM_Log::errorHandlerFatal method as shutdown function
  * Note: it still calls the original error handler if set_error_handler is able to return it.
  *
  * Errors will be mapped as:
  *   E_NOTICE, E_USER_NOTICE => NOTICE
  *   E_WARNING, E_CORE_WARNING, E_USER_WARNING => WARN
  *   E_ERROR, E_USER_ERROR, E_CORE_ERROR, E_RECOVERABLE_ERROR => ERR
  *   E_DEPRECATED, E_STRICT, E_USER_DEPRECATED => DEBUG
  *   (unknown/other) => INFO
  *
  * @link http://www.php.net/manual/en/function.set-error-handler.php Custom error handler
  * @link http://php.net/manual/en/function.register-tick-function.php
  * @see Zend_Log::registerErrorHandler()
  *
  * @return AM_Log
  */
 public function registerErrorHandler()
 {
     parent::registerErrorHandler();
     register_shutdown_function(array($this, 'errorHandlerFatal'));
     return $this;
 }
开发者ID:pansot2,项目名称:PadCMS-backend,代码行数:24,代码来源:Log.php


注:本文中的Zend_Log::registerErrorHandler方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。