Public Member Functions | Static Public Member Functions | Protected Attributes

Robo47_Log Class Reference

List of all members.

Public Member Functions

 getDefaultCategory ()
 Get default Category.
 getFilters ()
 Get Filters.
 getPriorities ()
 Get Priorities.
 getWriters ()
 Get Writers.
 log ($message, $priority, $extras=null)
 Log.
 removeFilter ($class)
 Removes a Filter.
 removeWriter ($class)
 Removes a writer.
 setDefaultCategory ($category=null)
 Set default Category.

Static Public Member Functions

static factory ($config=array())

Protected Attributes

 $_defaultCategory = null

Detailed Description

Definition at line 34 of file Log.php.


Member Function Documentation

static Robo47_Log::factory ( config = array()  )  [static]
Parameters:
array|Zend_Config $config
Returns:
Robo47_Log

Definition at line 48 of file Log.php.

Referenced by Robo47_Application_Resource_Log::_setupLog().

    {
        if ($config instanceof Zend_Config) {
            $config = $config->toArray();
        }

        if (!is_array($config) || empty($config)) {
            $message = 'Configuration must be an array or ' .
                'instance of Zend_Config';
            throw new Robo47_Log_Exception($message);
        }

        $log = new Robo47_Log();

        if (!is_array(current($config))) {
            $log->addWriter(current($config));
        } else {
            foreach ($config as $writer) {
                $log->addWriter($writer);
            }
        }

        return $log;
    }

Here is the caller graph for this function:

Robo47_Log::getDefaultCategory (  ) 

Get default Category.

Returns:
string

Definition at line 183 of file Log.php.

Referenced by log().

    {
        return $this->_defaultCategory;
    }

Here is the caller graph for this function:

Robo47_Log::getFilters (  ) 

Get Filters.

Returns:
array

Definition at line 136 of file Log.php.

    {
        return $this->_filters;
    }

Robo47_Log::getPriorities (  ) 

Get Priorities.

Returns:
array

Definition at line 161 of file Log.php.

    {
        return $this->_priorities;
    }

Robo47_Log::getWriters (  ) 

Get Writers.

Returns:
array|Zend_Log_Writer_Interface[]

Definition at line 78 of file Log.php.

    {
        return $this->_writers;
    }

Robo47_Log::log ( message,
priority,
extras = null 
)

Log.

Parameters:
string $message
integer $priority
mixed $extras

Definition at line 148 of file Log.php.

References getDefaultCategory().

    {
        if (!isset($extras['category']) && $this->_defaultCategory !== null) {
            $extras['category'] = $this->getDefaultCategory();
        }
        parent::log($message, $priority, $extras);
    }

Here is the call graph for this function:

Robo47_Log::removeFilter ( class  ) 

Removes a Filter.

Accepts the Filter or the classname as string

Parameters:
string|Robo47_Log_Filter_Interface $class
Returns:
Robo47_Log *Provides Fluent Interface*

Definition at line 115 of file Log.php.

    {
        foreach ($this->_filters as $key => $filter) {
            if (is_string($class)) {
                if ($filter instanceof $class) {
                    unset($this->_filters[$key]);
                }
            } elseif (is_object($class)) {
                if ($filter === $class) {
                    unset($this->_filters[$key]);
                }
            }
        }
        return $this;
    }

Robo47_Log::removeWriter ( class  ) 

Removes a writer.

Accepts the Writer or the classname as string

Parameters:
string|mixed $class
Returns:
Robo47_Log *Provides Fluent Interface*

Definition at line 91 of file Log.php.

    {
        foreach ($this->_writers as $key => $writer) {
            if (is_string($class)) {
                if ($writer instanceof $class) {
                    unset($this->_writers[$key]);
                }
            } elseif (is_object($class)) {
                if ($writer === $class) {
                    unset($this->_writers[$key]);
                }
            }
        }
        return $this;
    }

Robo47_Log::setDefaultCategory ( category = null  ) 

Set default Category.

Parameters:
string $category
Returns:
Robo47_Log *Provides Fluent Interface*

Definition at line 172 of file Log.php.

    {
        $this->_defaultCategory = $category;
        return $this;
    }


Member Data Documentation

Robo47_Log::$_defaultCategory = null [protected]

Definition at line 41 of file Log.php.


The documentation for this class was generated from the following file: