diff -r 5b37998e522e -r 162c1de6545a web/lib/Zend/Log/Writer/Abstract.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/lib/Zend/Log/Writer/Abstract.php Fri Mar 11 15:05:35 2011 +0100 @@ -0,0 +1,137 @@ +_filters[] = $filter; + return $this; + } + + /** + * Log a message to this writer. + * + * @param array $event log data event + * @return void + */ + public function write($event) + { + foreach ($this->_filters as $filter) { + if (! $filter->accept($event)) { + return; + } + } + + // exception occurs on error + $this->_write($event); + } + + /** + * Set a new formatter for this writer + * + * @param Zend_Log_Formatter_Interface $formatter + * @return void + */ + public function setFormatter(Zend_Log_Formatter_Interface $formatter) + { + $this->_formatter = $formatter; + return $this; + } + + /** + * Perform shutdown activites such as closing open resources + * + * @return void + */ + public function shutdown() + {} + + /** + * Write a message to the log. + * + * @param array $event log data event + * @return void + */ + abstract protected function _write($event); + + /** + * Validate and optionally convert the config to array + * + * @param array|Zend_Config $config Zend_Config or Array + * @return array + * @throws Zend_Log_Exception + */ + static protected function _parseConfig($config) + { + if ($config instanceof Zend_Config) { + $config = $config->toArray(); + } + + if (!is_array($config)) { + require_once 'Zend/Log/Exception.php'; + throw new Zend_Log_Exception( + 'Configuration must be an array or instance of Zend_Config' + ); + } + + return $config; + } +}