Log.php
Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to [email protected] so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Log
- Version
- $Id: Log.php 25131 2012-11-16 15:29:18Z rob $
\Zend_Log
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Version
- $Id: Log.php 25131 2012-11-16 15:29:18Z rob $
Constants
Properties

string $_defaultFilterNamespace = 'Zend_Log_Filter''Zend_Log_Filter'Details- Type
- string

string $_defaultFormatterNamespace = 'Zend_Log_Formatter''Zend_Log_Formatter'Details- Type
- string

string $_defaultWriterNamespace = 'Zend_Log_Writer''Zend_Log_Writer'Details- Type
- string

array $_filters = array()array()Details- Type
- array

array $_priorities = array()array()Details- Type
- array
Methods

__call(string $method, string $params) : voidUndefined method handler allows a shortcut: $log->priorityName('message') instead of $log->log('message', Zend_Log::PRIORITY_NAME)
| Name | Type | Description |
|---|---|---|
| $method | string | priority name |
| $params | string | message to log |
| Exception | Description |
|---|---|
| \Zend_Log_Exception |

__construct(\Zend_Log_Writer_Abstract | null $writer = null) : voidClass constructor.
Create a new logger
| Name | Type | Description |
|---|---|---|
| $writer | \Zend_Log_Writer_Abstract | null | default writer |

_constructFilterFromConfig(array | \Zend_Config $config) : \Zend_Log_Filter_InterfaceConstruct filter object from configuration array or Zend_Config object
| Name | Type | Description |
|---|---|---|
| $config | array | \Zend_Config | Zend_Config or Array |
| Type | Description |
|---|---|
| \Zend_Log_Filter_Interface |
| Exception | Description |
|---|---|
| \Zend_Log_Exception |

_constructFormatterFromConfig(array | \Zend_Config $config) : \Zend_Log_Formatter_InterfaceConstruct formatter object from configuration array or Zend_Config object
| Name | Type | Description |
|---|---|---|
| $config | array | \Zend_Config | Zend_Config or Array |
| Type | Description |
|---|---|
| \Zend_Log_Formatter_Interface |
| Exception | Description |
|---|---|
| \Zend_Log_Exception |

_constructFromConfig(string $type, mixed $config, string $namespace) : objectConstruct a filter or writer from config
| Name | Type | Description |
|---|---|---|
| $type | string | 'writer' of 'filter' |
| $config | mixed | Zend_Config or Array |
| $namespace | string |
| Type | Description |
|---|---|
| object |
| Exception | Description |
|---|---|
| \Zend_Log_Exception |

_constructWriterFromConfig( $config) : \Zend_Log_Writer_AbstractConstruct a writer object based on a configuration array
| Name | Type | Description |
|---|---|---|
| $config |
| Type | Description |
|---|---|
| \Zend_Log_Writer_Abstract |
| Exception | Description |
|---|---|
| \Zend_Log_Exception |

_packEvent(string $message, integer $priority) : arrayPacks message and priority into Event array
| Name | Type | Description |
|---|---|---|
| $message | string | Message to log |
| $priority | integer | Priority of message |
| Type | Description |
|---|---|
| array | Event array |

addFilter(int | \Zend_Config | array | \Zend_Log_Filter_Interface $filter) : \Zend_LogAdd a filter that will be applied before all log writers.
Before a message will be received by any of the writers, it must be accepted by all filters added with this method.
| Name | Type | Description |
|---|---|---|
| $filter | int | \Zend_Config | array | \Zend_Log_Filter_Interface |
| Type | Description |
|---|---|
| \Zend_Log |
| Exception | Description |
|---|---|
| \Zend_Log_Exception |

addPriority(string $name, integer $priority) : voidAdd a custom priority
| Name | Type | Description |
|---|---|---|
| $name | string | Name of priority |
| $priority | integer | Numeric priority |
| Exception | Description |
|---|---|
| \Zend_Log_Exception |

addWriter(mixed $writer) : \Zend_LogAdd a writer.
A writer is responsible for taking a log message and writing it out to storage.
| Name | Type | Description |
|---|---|---|
| $writer | mixed | Zend_Log_Writer_Abstract or Config array |
| Type | Description |
|---|---|
| \Zend_Log |

errorHandler(int $errno, string $errstr, string $errfile, int $errline, array $errcontext) : booleanError Handler will convert error into log message, and then call the original error handler
| Name | Type | Description |
|---|---|---|
| $errno | int | |
| $errstr | string | |
| $errfile | string | |
| $errline | int | |
| $errcontext | array |
| Type | Description |
|---|---|
| boolean |
- Link
- Custom error handler

factory(array | \Zend_Config $config = array()) : \Zend_LogFactory to construct the logger and one or more writers based on the configuration array
| Name | Type | Description |
|---|---|---|
| $config | array | \Zend_Config | Array or instance of Zend_Config |
| Type | Description |
|---|---|
| \Zend_Log |
| Exception | Description |
|---|---|
| \Zend_Log_Exception |

getClassName(array $config, string $type, string $defaultNamespace) : stringGet the writer or filter full classname
| Name | Type | Description |
|---|---|---|
| $config | array | |
| $type | string | filter|writer |
| $defaultNamespace | string |
| Type | Description |
|---|---|
| string | full classname |
| Exception | Description |
|---|---|
| \Zend_Log_Exception |

getTimestampFormat() : stringGet timestamp format used for log entries.
| Type | Description |
|---|---|
| string |

log(string $message, integer $priority, mixed $extras = null) : voidLog a message at a priority
| Name | Type | Description |
|---|---|---|
| $message | string | Message to log |
| $priority | integer | Priority of message |
| $extras | mixed | Extra information to log in event |
| Exception | Description |
|---|---|
| \Zend_Log_Exception |

registerErrorHandler() : \Zend_LogRegister Logging system as an error handler to log php errors Note: it still calls the original error handler if set_error_handler is able to return it.
Errors will be mapped as: E_NOTICE, E_USER_NOTICE => NOTICE E_WARNING, E_CORE_WARNING, E_USER_WARNING => WARN E_ERROR, E_USER_ERROR, E_CORE_ERROR, E_RECOVERABLE_ERROR => ERR E_DEPRECATED, E_STRICT, E_USER_DEPRECATED => DEBUG (unknown/other) => INFO
| Type | Description |
|---|---|
| \Zend_Log |
- Link
- Custom error handler

setEventItem(string $name, string $value) : \Zend_LogSet an extra item to pass to the log writers.
| Name | Type | Description |
|---|---|---|
| $name | string | Name of the field |
| $value | string | Value of the field |
| Type | Description |
|---|---|
| \Zend_Log |