Log.php

00001 <?php
00016 class Dsao_Log extends Zend_Log
00017 {
00021   const AFFIRM = 8;
00022 
00027   protected $_filterNamespace = null;
00028 
00032   protected $_writerMeta = null;
00033 
00042   public function __call($method, $params)
00043   {
00044       $priority = strtoupper($method);
00045 
00046       // Falls Priorität vorhanden
00047       if (false !== ($priority = array_search($priority, $this->_priorities)))
00048       {
00049           $message = array_shift($params);
00050           $namespace = array_shift($params);
00051 
00052           $this->log($message, $priority, $namespace);
00053       }
00054       else
00055       {
00056           throw new Dsao_Exception(array(
00057             'message' => 'dsao_log_bad_priority',
00058             'variables' => array('priority' => $priority)
00059             ));
00060       }
00061   }
00062 
00069   public function __construct(Zend_Log_Writer_Abstract $writer = null)
00070   {
00071     // Über diesen Filter können Nachrichten unterdrückt werden
00072     $this->_filter['namespace'] = new Dsao_Log_Filter_Namespace();
00073 
00074     // Writer für Meta-Informationen
00075     $this->_writerMeta = new Dsao_Log_Writer_Meta();
00076 
00077     // HTML-Writer
00078     $this->_writers['arrayObject'] = new Dsao_Log_Writer_ArrayObject();
00079 
00080     parent::__construct($writer);
00081   }
00082 
00088   public function getFilterNamespace()
00089   {
00090     return $this->_filters['namespace'];
00091   }
00092 
00098   public function getEvents()
00099   {
00100     return $this->_writers['arrayObject']->getEvents();
00101   }
00102 
00109   public function hasError($namespace = null)
00110   {
00111     return $this->_writerMeta->hasError($namespace);
00112   }
00113 
00123   public function log($message, $priority, $namespace = null)
00124   {
00125     // Namensbereich als weitere Eigenschaft des Ereignisses übergeben
00126     $this->_extras = array('namespace' => $namespace);
00127 
00128     $this->_writerMeta->write(array(
00129       'namespace' => $namespace,
00130       'priority' => $priority
00131       ));
00132 
00133     parent::log($message, $priority);
00134   }
00135 }

Erzeugt am Fri Sep 18 19:04:11 2009 für DSA online - Morgendaemmerung von  doxygen 1.5.7.1