Log.php

Show: PublicProtectedPrivateinherited
Table of Contents
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-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Log  
Version
$Id$  

\Zend_Log

Package: Zend_Log
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Version
$Id$  

Constants

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

Properties

>VPropertyprotectedstring $_defaultFilterNamespace = 'Zend_Log_Filter'
Default value'Zend_Log_Filter'Details
Type
string
>VPropertyprotectedstring $_defaultFormatterNamespace = 'Zend_Log_Formatter'
Default value'Zend_Log_Formatter'Details
Type
string
>VPropertyprotectedstring $_defaultWriterNamespace = 'Zend_Log_Writer'
Default value'Zend_Log_Writer'Details
Type
string
>VPropertyprotectedarray|boolean $_errorHandlerMap = false
Default valuefalseDetails
Type
array | boolean
>VPropertyprotectedarray $_extras = array()

of extra log event

Default valuearray()Details
Type
array
>VPropertyprotectedarray $_filters = array()

of Zend_Log_Filter_Interface

Default valuearray()Details
Type
array
>VPropertyprotectedcallback $_origErrorHandler = null
Default valuenullDetails
Type
callback
>VPropertyprotectedarray $_priorities = array()

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

Default valuearray()Details
Type
array
>VPropertyprotectedboolean $_registeredErrorHandler = false
Default valuefalseDetails
Type
boolean
>VPropertyprotectedstring $_timestampFormat = 'c'
Default value'c'Details
Type
string
>VPropertyprotectedarray $_writers = array()

of Zend_Log_Writer_Abstract

Default valuearray()Details
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
NameTypeDescription
$methodstring

priority name

$paramsstring

message to log

Throws
ExceptionDescription
\Zend_Log_Exception
methodpublic__construct(\Zend_Log_Writer_Abstract | null $writer = null) : void

Class constructor. Create a new logger

Parameters
NameTypeDescription
$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
NameTypeDescription
$configarray | \Zend_Config

Zend_Config or Array

Returns
TypeDescription
\Zend_Log_Filter_Interface
Throws
ExceptionDescription
\Zend_Log_Exception
methodprotected_constructFormatterFromConfig(array | \Zend_Config $config) : \Zend_Log_Formatter_Interface

Construct formatter object from configuration array or Zend_Config object

Parameters
NameTypeDescription
$configarray | \Zend_Config

Zend_Config or Array

Returns
TypeDescription
\Zend_Log_Formatter_Interface
Throws
ExceptionDescription
\Zend_Log_Exception
methodprotected_constructFromConfig(string $type, mixed $config, string $namespace) : object

Construct a filter or writer from config

Parameters
NameTypeDescription
$typestring

'writer' of 'filter'

$configmixed

Zend_Config or Array

$namespacestring
Returns
TypeDescription
object
Throws
ExceptionDescription
\Zend_Log_Exception
methodprotected_constructWriterFromConfig( $config) : \Zend_Log_Writer_Abstract

Construct a writer object based on a configuration array

Parameters
NameTypeDescription
$config
Returns
TypeDescription
\Zend_Log_Writer_Abstract
Throws
ExceptionDescription
\Zend_Log_Exception
methodprotected_packEvent(string $message, integer $priority) : array

Packs message and priority into Event array

Parameters
NameTypeDescription
$messagestring

Message to log

$priorityinteger

Priority of message

Returns
TypeDescription
arrayEvent 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
NameTypeDescription
$filterint | \Zend_Config | array | \Zend_Log_Filter_Interface
Returns
TypeDescription
\Zend_Log
Throws
ExceptionDescription
\Zend_Log_Exception
methodpublicaddPriority(string $name, integer $priority) : void

Add a custom priority

Parameters
NameTypeDescription
$namestring

Name of priority

$priorityinteger

Numeric priority

Throws
ExceptionDescription
\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
NameTypeDescription
$writermixed

Zend_Log_Writer_Abstract or Config array

Returns
TypeDescription
\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
NameTypeDescription
$errnoint
$errstrstring
$errfilestring
$errlineint
$errcontextarray
Returns
TypeDescription
boolean
Details
Link
Custom error handler  
methodpublicfactory( $config = array()) : \Zend_Log
static

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

Parameters
NameTypeDescription
$config
Returns
TypeDescription
\Zend_Log
Throws
ExceptionDescription
\Zend_Log_Exception
methodprotectedgetClassName(array $config, string $type, string $defaultNamespace) : string

Get the writer or filter full classname

Parameters
NameTypeDescription
$configarray
$typestring

filter|writer

$defaultNamespacestring
Returns
TypeDescription
stringfull classname
Throws
ExceptionDescription
\Zend_Log_Exception
methodpublicgetTimestampFormat() : string

Get timestamp format used for log entries.

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

Log a message at a priority

Parameters
NameTypeDescription
$messagestring

Message to log

$priorityinteger

Priority of message

$extrasmixed

Extra information to log in event

Throws
ExceptionDescription
\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
TypeDescription
\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
NameTypeDescription
$namestring

Name of the field

$valuestring

Value of the field

Returns
TypeDescription
\Zend_Log
methodpublicsetTimestampFormat(string $format) : \Zend_Log

Set timestamp format for log entries.

Parameters
NameTypeDescription
$formatstring
Returns
TypeDescription
\Zend_Log
Documentation was generated by phpDocumentor 2.2.0 .