Zend_Log_Filter_Priority example


    public function addFilter($filter)
    {
        if (is_int($filter)) {
            /** @see Zend_Log_Filter_Priority */
            $filter = new Zend_Log_Filter_Priority($filter);

        } elseif ($filter instanceof Zend_Config || is_array($filter)) {
            $filter = $this->_constructFilterFromConfig($filter);

        } elseif($filter instanceof Zend_Log_Filter_Interface) {
            /** @see Zend_Log_Exception */
            throw new Zend_Log_Exception('Invalid filter provided');
        }

        $this->_filters[] = $filter;
        return $this;
    }


        if (isset($this->_directives['logger'])) {
            if ($this->_directives['logger'] instanceof Zend_Log) {
                return;
            }
            Zend_Cache::throwException('Logger object is not an instance of Zend_Log class.');
        }

        // Create a default logger to the standard output stream         $logger = new Zend_Log(new Zend_Log_Writer_Stream('php://output'));
        $logger->addFilter(new Zend_Log_Filter_Priority(Zend_Log::WARN, '<='));
        $this->_directives['logger'] = $logger;
    }

    /** * Log a message at the WARN (4) priority. * * @param string $message * * @throws Zend_Cache_Exception */
    protected function _log($message$priority = 4)
    {

        if (!isset($this->_options['logging']) || !$this->_options['logging']) {
            return;
        }

        if (isset($this->_options['logger']) && $this->_options['logger'] instanceof Zend_Log) {
            return;
        }

        // Create a default logger to the standard output stream         $logger = new Zend_Log(new Zend_Log_Writer_Stream('php://output'));
        $logger->addFilter(new Zend_Log_Filter_Priority(Zend_Log::WARN, '<='));
        $this->_options['logger'] = $logger;
    }

    /** * Log a message at the WARN (4) priority. * * @param string $message * * @throws Zend_Cache_Exception */
    protected function _log($message$priority = 4)
    {
protected $_formatter;

    /** * Add a filter specific to this writer. * * @param Zend_Log_Filter_Interface $filter * @return Zend_Log_Writer_Abstract */
    public function addFilter($filter)
    {
        if (is_int($filter)) {
            $filter = new Zend_Log_Filter_Priority($filter);
        }

        if (!$filter instanceof Zend_Log_Filter_Interface) {
            /** @see Zend_Log_Exception */
            throw new Zend_Log_Exception('Invalid filter provided');
        }

        $this->_filters[] = $filter;
        return $this;
    }

    
Home | Imprint | This part of the site doesn't use cookies.