File indexing completed on 2024-06-23 05:55:02

0001 <?php
0002 /**
0003  * Zend Framework
0004  *
0005  * LICENSE
0006  *
0007  * This source file is subject to the new BSD license that is bundled
0008  * with this package in the file LICENSE.txt.
0009  * It is also available through the world-wide-web at this URL:
0010  * http://framework.zend.com/license/new-bsd
0011  * If you did not receive a copy of the license and are unable to
0012  * obtain it through the world-wide-web, please send an email
0013  * to license@zend.com so we can send you a copy immediately.
0014  *
0015  * @category   Zend
0016  * @package    Zend_Application
0017  * @subpackage Resource
0018  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0019  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0020  * @version    $Id$
0021  */
0022 
0023 /**
0024  * @see Zend_Application_Resource_ResourceAbstract
0025  */
0026 // require_once 'Zend/Application/Resource/ResourceAbstract.php';
0027 
0028 
0029 /**
0030  * Resource for initializing logger
0031  *
0032  * @uses       Zend_Application_Resource_ResourceAbstract
0033  * @category   Zend
0034  * @package    Zend_Application
0035  * @subpackage Resource
0036  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0037  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0038  */
0039 class Zend_Application_Resource_Log
0040     extends Zend_Application_Resource_ResourceAbstract
0041 {
0042     /**
0043      * @var Zend_Log
0044      */
0045     protected $_log;
0046 
0047     /**
0048      * Defined by Zend_Application_Resource_Resource
0049      *
0050      * @return Zend_Log
0051      */
0052     public function init()
0053     {
0054         return $this->getLog();
0055     }
0056 
0057     /**
0058      * Attach logger
0059      *
0060      * @param  Zend_Log $log
0061      * @return Zend_Application_Resource_Log
0062      */
0063     public function setLog(Zend_Log $log)
0064     {
0065         $this->_log = $log;
0066         return $this;
0067     }
0068 
0069     /**
0070      * Retrieve logger object
0071      *
0072      * @return Zend_Log
0073      */
0074     public function getLog()
0075     {
0076         if (null === $this->_log) {
0077             $options = $this->getOptions();
0078             $log = Zend_Log::factory($options);
0079             $this->setLog($log);
0080         }
0081         return $this->_log;
0082     }
0083 }