Beispiel #1
0
 /**
  * Registers a new ErrorHandler for a given Logger
  *
  * By default it will handle errors, exceptions and fatal errors
  *
  * @param \ACP3\Core\Logger $logger
  *
  * @return $this
  */
 public static function register(Logger $logger)
 {
     $handler = new static($logger);
     $handler->registerErrorHandler();
     $handler->registerExceptionHandler();
     $handler->registerFatalHandler();
     return $handler;
 }
Beispiel #2
0
 /**
  * Registers a new ErrorHandler for a given Logger
  *
  * By default it will handle errors, exceptions and fatal errors
  *
  * @param  LoggerInterface $logger
  * @param  array|false     $errorLevelMap  an array of E_* constant to LogLevel::* constant mapping, or false to disable error handling
  * @param  int|false       $exceptionLevel a LogLevel::* constant, or false to disable exception handling
  * @param  int|false       $fatalLevel     a LogLevel::* constant, or false to disable fatal error handling
  * @return ErrorHandler
  */
 public static function register(LoggerInterface $logger, $errorLevelMap = array(), $exceptionLevel = null, $fatalLevel = null)
 {
     $handler = new static($logger);
     if ($errorLevelMap !== false) {
         $handler->registerErrorHandler($errorLevelMap);
     }
     if ($exceptionLevel !== false) {
         $handler->registerExceptionHandler($exceptionLevel);
     }
     if ($fatalLevel !== false) {
         $handler->registerFatalHandler($fatalLevel);
     }
     return $handler;
 }