getZendLoggerPsr3Mapping() public static method

public static getZendLoggerPsr3Mapping ( ) : array
return array
Ejemplo n.º 1
0
 /**
  * @deprecated
  * @param $level
  */
 public function setFilterPriority($level)
 {
     // legacy ZF method
     $zendLoggerPsr3Mapping = Logger::getZendLoggerPsr3Mapping();
     if (isset($zendLoggerPsr3Mapping[$level])) {
         $level = $zendLoggerPsr3Mapping[$level];
         $this->setLevel($level);
     }
 }
Ejemplo n.º 2
0
 /**
  * @param mixed $level
  * @param string $message
  * @param array $context
  * @return null
  */
 public function log($level, $message, array $context = [])
 {
     if (!isset($context["component"])) {
         $context["component"] = $this->component;
     }
     if (!isset($context["fileObject"]) && $this->fileObject) {
         $context["fileObject"] = $this->fileObject;
     }
     if (isset($context["fileObject"])) {
         if (is_string($context["fileObject"])) {
             $context["fileObject"] = \Pimcore\Tool::getHostUrl() . "/" . str_replace(PIMCORE_DOCUMENT_ROOT, '', $context["fileObject"]);
         } else {
             $context["fileObject"] = \Pimcore\Tool::getHostUrl() . "/" . str_replace(PIMCORE_DOCUMENT_ROOT, '', $context["fileObject"]->getFilename());
         }
     }
     $relatedObject = null;
     if (isset($context["relatedObject"])) {
         $relatedObject = $context["relatedObject"];
     }
     if (!$relatedObject && $this->relatedObject) {
         $relatedObject = $this->relatedObject;
     }
     if ($relatedObject) {
         if ($relatedObject instanceof \Pimcore\Model\Object\AbstractObject or $relatedObject instanceof \Pimcore\Model\Document or $relatedObject instanceof \Pimcore\Model\Asset) {
             $relatedObject = $relatedObject->getId();
         }
         if (is_numeric($relatedObject)) {
             $context["relatedObject"] = $relatedObject;
             $context["relatedObjectType"] = $this->relatedObjectType;
         }
     }
     $context['source'] = $this->resolveLoggingSource();
     foreach ($this->loggers as $logger) {
         if ($logger instanceof \Psr\Log\LoggerInterface) {
             $logger->log($level, $message, $context);
         } elseif ($logger instanceof \Zend_Log) {
             // zf compatibility
             $zendLoggerPsr3Mapping = array_flip(Logger::getZendLoggerPsr3Mapping());
             $prio = $zendLoggerPsr3Mapping[$level];
             $logger->log($message, $prio, $context);
         }
     }
     return null;
 }