Example #1
0
 /**
  * Sets the given Zend_Log object into the internal log property.
  * If no log given, a new instance with the internal configuration will be created.
  * @param Enlight_Components_Log|Zend_Log $log
  */
 public function setResource(Zend_Log $log = null)
 {
     if ($log === null) {
         $config = $this->Config();
         if (count($config) === 0) {
             $config = new Enlight_Config(array(array('writerName' => 'Null'), array('writerName' => 'Firebug')));
         }
         $log = Enlight_Components_Log::factory($config);
     }
     $this->log = $log;
 }
Example #2
0
 /**
  * Sets the given Zend_Log object into the internal log property.
  * If no log given, a new instance with the internal configuration will be created.
  * @param Enlight_Components_Log|Zend_Log $log
  */
 public function setResource(Zend_Log $log = null)
 {
     if ($log === null) {
         $log = new Enlight_Components_Log();
         $log->setEventItem('date', Zend_Date::now());
         $log->addWriter(new Zend_Log_Writer_Null());
         $config = $this->Config();
         if(!empty($config->logDb)) {
             $writer = Zend_Log_Writer_Db::factory(array(
                 'db' => Shopware()->Db(),
                 'table' => 's_core_log',
                 'columnmap' => array(
                     'type' => 'priority',
                     'key' => 'priorityName',
                     'text' => 'message',
                     'date' => 'date',
                     'ip_address' => 'remote_address',
                     'user_agent' => 'user_agent',
                 )
             ));
             $writer->addFilter(Enlight_Components_Log::WARN);
             $log->addWriter($writer);
         }
         if(!empty($config->logMail)) {
             $mail = new Enlight_Components_Mail();
             $mail->addTo(Shopware()->Config()->Mail);
             $writer = new Zend_Log_Writer_Mail($mail);
             $writer->setSubjectPrependText('Fehler im Shop "'.Shopware()->Config()->Shopname.'" aufgetreten!');
             $writer->addFilter(Enlight_Components_Log::WARN);
             $log->addWriter($writer);
         }
     }
     $this->log = $log;
 }