crit() public method

public crit ( $message, array $context = [] )
$context array
 /**
  * @param mixed $level
  * @param string $message
  * @param array $context
  * @return null
  * @throws PsrInvalidArgumentException
  */
 public function log($level, $message, array $context = array())
 {
     switch ($level) {
         case PsrLogLevel::ALERT:
             $this->symfonyLogger->alert($message, $context);
             break;
         case PsrLogLevel::CRITICAL:
             $this->symfonyLogger->crit($message, $context);
             break;
         case PsrLogLevel::DEBUG:
             $this->symfonyLogger->debug($message, $context);
             break;
         case PsrLogLevel::EMERGENCY:
             $this->symfonyLogger->emerg($message, $context);
             break;
         case PsrLogLevel::ERROR:
             $this->symfonyLogger->err($message, $context);
             break;
         case PsrLogLevel::INFO:
             $this->symfonyLogger->info($message, $context);
             break;
         case PsrLogLevel::NOTICE:
             $this->symfonyLogger->notice($message, $context);
             break;
         case PsrLogLevel::WARNING:
             $this->symfonyLogger->warn($message, $context);
             break;
         default:
             throw new PsrInvalidArgumentException(sprintf('Loglevel "%s" not valid, use constants from "%s"', $level, "Psr\\Log\\LogLevel"));
             break;
     }
     return null;
 }
 /**
  * Logs exceptions
  *
  * @param \Exception  $originalException  Original exception that called the listener
  * @param \Exception  $generatedException Generated exception
  * @param string|null $message            Message to log
  */
 private function logException(\Exception $originalException, \Exception $generatedException, $message = null)
 {
     if (!$message) {
         $message = sprintf('Exception thrown when handling an exception (%s: %s)', get_class($generatedException), $generatedException->getMessage());
     }
     if (null !== $this->logger) {
         if (!$originalException instanceof HttpExceptionInterface || $originalException->getStatusCode() >= 500) {
             $this->logger->crit($message);
         } else {
             $this->logger->err($message);
         }
     } else {
         error_log($message);
     }
 }
Example #3
0
 /**
  * A convenience function for logging a critical event.
  *
  * @param mixed $message the message to log.
  */
 public function crit($message)
 {
     if (null !== $this->logger) {
         $this->logger->crit($message);
     }
 }
Example #4
0
 /**
  * A convenience function for logging a critical event.
  *
  * @param mixed $message the message to log.
  */
 public function crit($message)
 {
     $this->logger->crit($message);
 }