API Documentation

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 license@zend.com so we can send you a copy immediately.

category
Zend  
copyright
Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)  
license
New BSD License  
package
Zend_Log  
version
$Id: Log.php 23783 2011-03-01 21:47:35Z intiilapa $  

\Zend_Log

category
Zend  
copyright
Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)  
license
New BSD License  
package
Zend_Log  
version
$Id: Log.php 23783 2011-03-01 21:47:35Z intiilapa $  

Constants

Constant  EMERG = '0'
Constant  ALERT = '1'
Constant  CRIT = '2'
Constant  ERR = '3'
Constant  WARN = '4'
Constant  NOTICE = '5'
Constant  INFO = '6'
Constant  DEBUG = '7'

Properties

Propertyprotectedstring  $_defaultFilterNamespace= 'Zend_Log_Filter'

Default valueZend_Log_FilterDetails
Type
string
Propertyprotectedstring  $_defaultFormatterNamespace= 'Zend_Log_Formatter'

Default valueZend_Log_FormatterDetails
Type
string
Propertyprotectedstring  $_defaultWriterNamespace= 'Zend_Log_Writer'

Default valueZend_Log_WriterDetails
Type
string
Propertyprotectedarray|boolean  $_errorHandlerMap= 'false'

Default valuefalseDetails
Type
arrayboolean
Propertyprotectedarray  $_extras= 'array'

of extra log event
Default valuearrayDetails
Type
array
Propertyprotectedarray  $_filters= 'array'

of Zend_Log_Filter_Interface
Default valuearrayDetails
Type
array
Propertyprotectedcallback  $_origErrorHandler= 'null'

Default valuenullDetails
Type
callback
Propertyprotectedarray  $_priorities= 'array'

of priorities where the keys are the priority numbers and the values are the priority names
Default valuearrayDetails
Type
array
Propertyprotectedboolean  $_registeredErrorHandler= 'false'

Default valuefalseDetails
Type
boolean
Propertyprotectedstring  $_timestampFormat= 'c'

Default valuecDetails
Type
string
Propertyprotectedarray  $_writers= 'array'

of Zend_Log_Writer_Abstract
Default valuearrayDetails
Type
array

Methods

methodpublic__call( string $method, string $params ) : void

Undefined method handler allows a shortcut: $log->priorityName('message') instead of $log->log('message', Zend_Log::PRIORITY_NAME)

Parameters
Name Type Description
$method string priority name
$params string message to log
Throws
Exception Description
\Zend_Log_Exception
methodpublic__construct( \Zend_Log_Writer_Abstract|null $writer = null ) : void

Class constructor. Create a new logger

Parameters
Name Type Description
$writer \Zend_Log_Writer_Abstract|null default writer
methodpublic__destruct( ) : void

Class destructor. Shutdown log writers

methodprotected_constructFilterFromConfig( array|\Zend_Config $config ) : \Zend_Log_Filter_Interface

Construct filter object from configuration array or Zend_Config object

Parameters
Name Type Description
$config array|\Zend_Config Zend_Config or Array
Returns
Type Description
\Zend_Log_Filter_Interface
Throws
Exception Description
\Zend_Log_Exception
methodprotected_constructFormatterFromConfig( array|\Zend_Config $config ) : \Zend_Log_Formatter_Interface

Construct formatter object from configuration array or Zend_Config object

Parameters
Name Type Description
$config array|\Zend_Config Zend_Config or Array
Returns
Type Description
\Zend_Log_Formatter_Interface
Throws
Exception Description
\Zend_Log_Exception
methodprotected_constructFromConfig( string $type, mixed $config, string $namespace ) : object

Construct a filter or writer from config

Parameters
Name Type Description
$type string

'writer' of 'filter'

$config mixed Zend_Config or Array
$namespace string
Returns
Type Description
object
Throws
Exception Description
\Zend_Log_Exception
methodprotected_constructWriterFromConfig(  $config ) : \Zend_Log_Writer_Abstract

Construct a writer object based on a configuration array

Parameters
Name Type Description
$config
Returns
Type Description
\Zend_Log_Writer_Abstract
Throws
Exception Description
\Zend_Log_Exception
methodprotected_packEvent( string $message, integer $priority ) : array

Packs message and priority into Event array

Parameters
Name Type Description
$message string Message to log
$priority integer Priority of message
Returns
Type Description
array Event array
methodpublicaddFilter( int|\Zend_Config|array|\Zend_Log_Filter_Interface $filter ) : \Zend_Log

Add 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.

Parameters
Name Type Description
$filter int|\Zend_Config|array|\Zend_Log_Filter_Interface
Returns
Type Description
\Zend_Log
Throws
Exception Description
\Zend_Log_Exception
methodpublicaddPriority( string $name, integer $priority ) : void

Add a custom priority

Parameters
Name Type Description
$name string Name of priority
$priority integer Numeric priority
Throws
Exception Description
\Zend_Log_Exception
methodpublicaddWriter( mixed $writer ) : \Zend_Log

Add a writer. A writer is responsible for taking a log message and writing it out to storage.

Parameters
Name Type Description
$writer mixed Zend_Log_Writer_Abstract or Config array
Returns
Type Description
\Zend_Log
methodpublicerrorHandler( int $errno, string $errstr, string $errfile, int $errline, array $errcontext ) : boolean

Error Handler will convert error into log message, and then call the original error handler

Parameters
Name Type Description
$errno int
$errstr string
$errfile string
$errline int
$errcontext array
Returns
Type Description
boolean
Details
link
Custom error handler  
methodpublicfactory( array|\Zend_Config $config = array ) : \Zend_Log
static

Factory to construct the logger and one or more writers based on the configuration array

Parameters
Name Type Description
$config array|\Zend_Config Array or instance of Zend_Config
Returns
Type Description
\Zend_Log
Throws
Exception Description
\Zend_Log_Exception
methodprotectedgetClassName( array $config, string $type, string $defaultNamespace ) : string

Get the writer or filter full classname

Parameters
Name Type Description
$config array
$type string filter|writer
$defaultNamespace string
Returns
Type Description
string full classname
Throws
Exception Description
\Zend_Log_Exception
methodpublicgetTimestampFormat( ) : string

Get timestamp format used for log entries.

Returns
Type Description
string
methodpubliclog( string $message, integer $priority, mixed $extras = null ) : void

Log a message at a priority

Parameters
Name Type Description
$message string Message to log
$priority integer Priority of message
$extras mixed Extra information to log in event
Throws
Exception Description
\Zend_Log_Exception
methodpublicregisterErrorHandler( ) : \Zend_Log

Register 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

Returns
Type Description
\Zend_Log
Details
link
Custom error handler  
methodpublicsetEventItem( string $name, string $value ) : \Zend_Log

Set an extra item to pass to the log writers.

Parameters
Name Type Description
$name string Name of the field
$value string Value of the field
Returns
Type Description
\Zend_Log
methodpublicsetTimestampFormat( string $format ) : \Zend_Log

Set timestamp format for log entries.

Parameters
Name Type Description
$format string
Returns
Type Description
\Zend_Log
Documentation was generated by DocBlox 0.13.3.