category Zend
package Zend_Log
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License
version $Id$ Convenience methods for log [@see Zend_Log::__call()]:

 Methods

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

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

Parameters

$method

string

priority name

$params

string

message to log

Exceptions

\Zend_Log_Exception

Class constructor. Create a new logger

__construct(\Zend_Log_Writer_Abstract|null $writer = null

Parameters

$writer

\Zend_Log_Writer_Abstractnull

default writer

Class destructor. Shutdown log writers

__destruct() : void

Add a filter that will be applied before all log writers.

addFilter(integer|\Zend_Config|array|\Zend_Log_Filter_Interface $filter) : \Zend_Log

Before a message will be received by any of the writers, it must be accepted by all filters added with this method.

fluent This method is part of a fluent interface and will return the same instance

Parameters

$filter

integer\Zend_Configarray\Zend_Log_Filter_Interface

Exceptions

\Zend_Log_Exception

Returns

\Zend_Log

Add a custom priority

addPriority(string $name, integer $priority) : \Zend_Log
fluent This method is part of a fluent interface and will return the same instance

Parameters

$name

string

Name of priority

$priority

integer

Numeric priority

Exceptions

\Zend_Log_Exception

Returns

\Zend_Log

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

addWriter(mixed $writer) : \Zend_Log

Parameters

$writer

mixed

Zend_Log_Writer_Abstract or Config array

Exceptions

\Zend_Log_Exception

Returns

\Zend_Log

alert()

alert() : 
magic
method

Returns

crit()

crit() : 
magic
method

Returns

debug()

debug() : 
magic
method

Returns

emerg()

emerg() : 
magic
method

Returns

err()

err() : 
magic
method

Returns

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

errorHandler(integer $errno, string $errstr, string $errfile, integer $errline, array $errcontext) : boolean
link Custom error handler

Parameters

$errno

integer

$errstr

string

$errfile

string

$errline

integer

$errcontext

array

Returns

boolean

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

factory($config = array()) : \Zend_Log
Static

Parameters

$config

Exceptions

\Zend_Log_Exception

Returns

\Zend_Log

Get timestamp format used for log entries.

getTimestampFormat() : string

Returns

string

info()

info() : 
magic
method

Returns

Log a message at a priority

log(string $message, integer $priority, mixed $extras = null) : void

Parameters

$message

string

Message to log

$priority

integer

Priority of message

$extras

mixed

Extra information to log in event

Exceptions

\Zend_Log_Exception

notice()

notice() : 
magic
method

Returns

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.

registerErrorHandler() : \Zend_Log

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

link Custom error handler

Returns

\Zend_Log

Set an extra item to pass to the log writers.

setEventItem(string $name, string $value) : \Zend_Log

Parameters

$name

string

Name of the field

$value

string

Value of the field

Returns

\Zend_Log

Set timestamp format for log entries.

setTimestampFormat(string $format) : \Zend_Log

Parameters

$format

string

Returns

\Zend_Log

warn()

warn() : 
magic
method

Returns

Construct filter object from configuration array or Zend_Config object

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

Parameters

$config

array\Zend_Config

Zend_Config or Array

Exceptions

\Zend_Log_Exception

Returns

\Zend_Log_Filter_Interface

Construct formatter object from configuration array or Zend_Config object

_constructFormatterFromConfig(array|\Zend_Config $config) : \Zend_Log_Formatter_Interface

Parameters

$config

array\Zend_Config

Zend_Config or Array

Exceptions

\Zend_Log_Exception

Returns

\Zend_Log_Formatter_Interface

Construct a filter or writer from config

_constructFromConfig(string $type, mixed $config, string $namespace) : object

Parameters

$type

string

'writer' of 'filter'

$config

mixed

Zend_Config or Array

$namespace

string

Exceptions

\Zend_Log_Exception

Returns

object

Construct a writer object based on a configuration array

_constructWriterFromConfig(array $config) : \Zend_Log_Writer_Abstract

Parameters

$config

array

config array with writer spec

Exceptions

\Zend_Log_Exception

Returns

\Zend_Log_Writer_Abstract

Packs message and priority into Event array

_packEvent(string $message, integer $priority) : array

Parameters

$message

string

Message to log

$priority

integer

Priority of message

Returns

arrayEvent array

Get the writer or filter full classname

getClassName(array $config, string $type, string $defaultNamespace) : string

Parameters

$config

array

$type

string

filter|writer

$defaultNamespace

string

Exceptions

\Zend_Log_Exception

Returns

stringfull classname

 Properties

 

$_defaultFilterNamespace

$_defaultFilterNamespace : string

Default

'Zend_Log_Filter'
 

$_defaultFormatterNamespace

$_defaultFormatterNamespace : string

Default

'Zend_Log_Formatter'
 

$_defaultWriterNamespace

$_defaultWriterNamespace : string

Default

'Zend_Log_Writer'
 

$_errorHandlerMap

$_errorHandlerMap : array | boolean

Default

false
 

of extra log event

$_extras : array

Default

array()
 

of Zend_Log_Filter_Interface

$_filters : array

Default

array()
 

$_origErrorHandler

$_origErrorHandler : callback

Default

null
 

of priorities where the keys are the priority numbers and the values are the priority names

$_priorities : array

Default

array()
 

$_registeredErrorHandler

$_registeredErrorHandler : boolean

Default

false
 

$_timestampFormat

$_timestampFormat : string

Default

'c'
 

of Zend_Log_Writer_Abstract

$_writers : array

Default

array()

 Constants

 

ALERT

ALERT = 1 
 

CRIT

CRIT = 2 
 

DEBUG

DEBUG = 7 
 

EMERG

EMERG = 0 
 

ERR

ERR = 3 
 

INFO

INFO = 6 
 

NOTICE

NOTICE = 5 
 

WARN

WARN = 4