Log.php

Go to the documentation of this file.
00001 <?php
00002 
00033 class Robo47_Application_Resource_Log
00034 extends Zend_Application_Resource_ResourceAbstract
00035 {
00036 
00040     protected $_log = null;
00041     
00042     public function init()
00043     {
00044         if (!empty($this->_options)) {
00045             $this->_log = $this->_setupLog($this->_options);
00046         } else {
00047             $message = 'Empty options in resource ' .
00048                 'Robo47_Application_Resource_Log.';
00049             throw new Robo47_Application_Resource_Exception($message);
00050         }
00051     }
00052 
00059     protected function _setupLog($options)
00060     {
00061         $registryKey = null;
00062         if (isset($options['registryKey'])) {
00063             $registryKey = $options['registryKey'];
00064             unset($options['registryKey']);
00065         }
00066         $log = Robo47_Log::factory($options);
00067 
00068         if (null !== $registryKey) {
00069             Zend_Registry::set($registryKey, $log);
00070         }
00071         return $log;
00072     }
00073 
00079     public function getLog()
00080     {
00081         return $this->_log;
00082     }
00083 }