Definition at line 40 of file Log.php.
◆ __construct()
Class constructor. Create a new logger
- Parameters
-
Definition at line 119 of file Log.php.
121 $r =
new ReflectionClass($this);
122 $this->_priorities = array_flip($r->getConstants());
124 if ($writer !==
null) {
◆ __call()
__call |
( |
|
$method, |
|
|
|
$params |
|
) |
| |
Undefined method handler allows a shortcut: $log->priorityName('message') instead of $log->log('message', Zend_Log::PRIORITY_NAME)
- Parameters
-
string | $method | priority name |
string | $params | message to log |
- Returns
- void
- Exceptions
-
- See also
- Zend_Log_Exception
-
Zend_Log_Exception
Definition at line 381 of file Log.php.
383 $priority = strtoupper(
$method);
384 if (($priority = array_search($priority, $this->_priorities)) !==
false) {
388 #require_once 'Zend/Log/Exception.php'; 396 $extras = array_shift(
$params);
399 $this->log(
$message, $priority, $extras);
402 #require_once 'Zend/Log/Exception.php';
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
◆ _constructFilterFromConfig()
_constructFilterFromConfig |
( |
|
$config | ) |
|
|
protected |
Construct filter object from configuration array or Zend_Config object
- Parameters
-
- Returns
- Zend_Log_Filter_Interface
- Exceptions
-
- See also
- Zend_Log_Exception
Definition at line 223 of file Log.php.
228 $filterName = is_object($filter)
230 :
'The specified filter';
232 #require_once 'Zend/Log/Exception.php'; 233 throw new Zend_Log_Exception(
"{$filterName} does not implement Zend_Log_Filter_Interface");
_constructFromConfig($type, $config, $namespace)
◆ _constructFormatterFromConfig()
_constructFormatterFromConfig |
( |
|
$config | ) |
|
|
protected |
Construct formatter object from configuration array or Zend_Config object
- Parameters
-
- Returns
- Zend_Log_Formatter_Interface
- Exceptions
-
- See also
- Zend_Log_Exception
Definition at line 246 of file Log.php.
251 $formatterName = is_object($formatter)
252 ? get_class($formatter)
253 :
'The specified formatter';
255 #require_once 'Zend/Log/Exception.php'; 256 throw new Zend_Log_Exception($formatterName .
' does not implement Zend_Log_Formatter_Interface');
_constructFromConfig($type, $config, $namespace)
◆ _constructFromConfig()
_constructFromConfig |
( |
|
$type, |
|
|
|
$config, |
|
|
|
$namespace |
|
) |
| |
|
protected |
Construct a filter or writer from config
- Parameters
-
string | $type | 'writer' of 'filter' |
mixed | $config | Zend_Config or Array |
string | $namespace | |
- Returns
- object
- Exceptions
-
Definition at line 271 of file Log.php.
278 #require_once 'Zend/Log/Exception.php'; 280 'Configuration must be an array or instance of Zend_Config' 287 #require_once 'Zend/Loader.php'; 291 $reflection =
new ReflectionClass(
$className);
292 if (!$reflection->implementsInterface(
'Zend_Log_FactoryInterface')) {
293 #require_once 'Zend/Log/Exception.php'; 295 $className .
' does not implement Zend_Log_FactoryInterface and can not be constructed from config.' static loadClass($class, $dirs=null)
call_user_func($callable, $param)
getClassName($config, $type, $defaultNamespace)
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
◆ _constructWriterFromConfig()
_constructWriterFromConfig |
( |
|
$config | ) |
|
|
protected |
Construct a writer object based on a configuration array
- Parameters
-
array | $config | config array with writer spec |
- Returns
- Zend_Log_Writer_Abstract
- Exceptions
-
- See also
- Zend_Log_Exception
Definition at line 190 of file Log.php.
195 $writerName = is_object($writer)
197 :
'The specified writer';
199 #require_once 'Zend/Log/Exception.php'; 200 throw new Zend_Log_Exception(
"{$writerName} does not extend Zend_Log_Writer_Abstract!");
203 if (isset(
$config[
'filterName'])) {
205 $writer->addFilter($filter);
208 if (isset(
$config[
'formatterName'])) {
210 $writer->setFormatter($formatter);
_constructFormatterFromConfig($config)
_constructFilterFromConfig($config)
_constructFromConfig($type, $config, $namespace)
◆ _packEvent()
_packEvent |
( |
|
$message, |
|
|
|
$priority |
|
) |
| |
|
protected |
Packs message and priority into Event array
- Parameters
-
string | $message | Message to log |
integer | $priority | Priority of message |
- Returns
- array Event array
Definition at line 345 of file Log.php.
347 return array_merge(array(
348 'timestamp' => date($this->_timestampFormat),
350 'priority' => $priority,
351 'priorityName' => $this->_priorities[$priority]
◆ addFilter()
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
-
- Returns
- $this
- Exceptions
-
- See also
- Zend_Log_Filter_Priority
-
Zend_Log_Exception
Definition at line 501 of file Log.php.
503 if (is_int($filter)) {
505 #require_once 'Zend/Log/Filter/Priority.php'; 513 #require_once 'Zend/Log/Exception.php'; 517 $this->_filters[] = $filter;
elseif(isset( $params[ 'redirect_parent']))
_constructFilterFromConfig($config)
◆ addPriority()
addPriority |
( |
|
$name, |
|
|
|
$priority |
|
) |
| |
Add a custom priority
- Parameters
-
string | $name | Name of priority |
integer | $priority | Numeric priority |
- Returns
- $this
- Exceptions
-
- See also
- Zend_Log_Exception
Definition at line 476 of file Log.php.
481 if (isset($this->_priorities[$priority])
482 ||
false !== array_search(
$name, $this->_priorities)) {
484 #require_once 'Zend/Log/Exception.php'; 488 $this->_priorities[$priority] =
$name;
if(!isset($_GET['name'])) $name
◆ addWriter()
Add a writer. A writer is responsible for taking a log message and writing it out to storage.
- Parameters
-
- Returns
- Zend_Log
- Exceptions
-
- See also
- Zend_Log_Exception
Definition at line 529 of file Log.php.
531 if (is_array($writer) || $writer instanceof
Zend_Config) {
537 #require_once 'Zend/Log/Exception.php'; 539 'Writer must be an instance of Zend_Log_Writer_Abstract' 540 .
' or you should pass a configuration array' 544 $this->_writers[] = $writer;
_constructWriterFromConfig($config)
◆ errorHandler()
errorHandler |
( |
|
$errno, |
|
|
|
$errstr, |
|
|
|
$errfile, |
|
|
|
$errline, |
|
|
|
$errcontext |
|
) |
| |
Error Handler will convert error into log message, and then call the original error handler
Custom error handler int $errno string $errstr string $errfile int $errline array $errcontext boolean
Definition at line 622 of file Log.php.
624 $errorLevel = error_reporting();
626 if ($errorLevel & $errno) {
627 if (isset($this->_errorHandlerMap[$errno])) {
628 $priority = $this->_errorHandlerMap[$errno];
632 $this->log($errstr, $priority, array(
'errno'=>$errno,
'file'=>$errfile,
'line'=>$errline,
'context'=>$errcontext));
635 if ($this->_origErrorHandler !==
null) {
636 return call_user_func($this->_origErrorHandler, $errno, $errstr, $errfile, $errline, $errcontext);
call_user_func($callable, $param)
◆ factory()
static factory |
( |
|
$config = array() | ) |
|
|
static |
Factory to construct the logger and one or more writers based on the configuration array
- Parameters
-
- Returns
- Zend_Log
- Exceptions
-
- See also
- Zend_Log_Exception
-
Zend_Log_Exception
Definition at line 137 of file Log.php.
145 #require_once 'Zend/Log/Exception.php'; 146 throw new Zend_Log_Exception(
'Configuration must be an array or instance of Zend_Config');
149 if (array_key_exists(
'className',
$config)) {
160 #require_once 'Zend/Log/Exception.php'; 161 throw new Zend_Log_Exception(
'Passed className does not belong to a descendant of Zend_Log');
164 if (array_key_exists(
'timestampFormat',
$config)) {
165 if (
null !=
$config[
'timestampFormat'] &&
'' !=
$config[
'timestampFormat']) {
166 $log->setTimestampFormat(
$config[
'timestampFormat']);
168 unset(
$config[
'timestampFormat']);
171 if (!is_array(current(
$config))) {
172 $log->addWriter(current(
$config));
175 $log->addWriter($writer);
$_option $_optionId $class
◆ getClassName()
getClassName |
( |
|
$config, |
|
|
|
$type, |
|
|
|
$defaultNamespace |
|
) |
| |
|
protected |
Get the writer or filter full classname
- Parameters
-
array | $config | |
string | $type | filter|writer |
string | $defaultNamespace | |
- Returns
- string full classname
- Exceptions
-
Definition at line 311 of file Log.php.
314 #require_once 'Zend/Log/Exception.php'; 319 $namespace = $defaultNamespace;
326 if (substr($namespace, -1) ==
'\\') {
331 if (strlen($namespace) === 0) {
◆ getTimestampFormat()
Get timestamp format used for log entries.
- Returns
- string
Definition at line 658 of file Log.php.
◆ registerErrorHandler()
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
Custom error handler Zend_Log
Definition at line 576 of file Log.php.
579 if ($this->_registeredErrorHandler) {
583 $this->_origErrorHandler = set_error_handler(array($this,
'errorHandler'));
587 $this->_errorHandlerMap = array(
600 if (defined(
'E_DEPRECATED')) {
603 if (defined(
'E_USER_DEPRECATED')) {
607 $this->_registeredErrorHandler =
true;
◆ setEventItem()
setEventItem |
( |
|
$name, |
|
|
|
$value |
|
) |
| |
Set an extra item to pass to the log writers.
- Parameters
-
string | $name | Name of the field |
string | $value | Value of the field |
- Returns
- Zend_Log
Definition at line 555 of file Log.php.
557 $this->_extras = array_merge($this->_extras, array(
$name =>
$value));
if(!isset($_GET['name'])) $name
◆ setTimestampFormat()
setTimestampFormat |
( |
|
$format | ) |
|
Set timestamp format for log entries.
- Parameters
-
- Returns
- Zend_Log
Definition at line 647 of file Log.php.
649 $this->_timestampFormat =
$format;
◆ $_defaultFilterNamespace
$_defaultFilterNamespace = 'Zend_Log_Filter' |
|
protected |
◆ $_defaultFormatterNamespace
$_defaultFormatterNamespace = 'Zend_Log_Formatter' |
|
protected |
◆ $_defaultWriterNamespace
$_defaultWriterNamespace = 'Zend_Log_Writer' |
|
protected |
◆ $_errorHandlerMap
$_errorHandlerMap = false |
|
protected |
◆ $_extras
◆ $_filters
◆ $_origErrorHandler
$_origErrorHandler = null |
|
protected |
◆ $_priorities
◆ $_registeredErrorHandler
$_registeredErrorHandler = false |
|
protected |
◆ $_timestampFormat
◆ $_writers
◆ ALERT
◆ CRIT
◆ DEBUG
◆ EMERG
◆ ERR
◆ INFO
◆ NOTICE
◆ WARN
The documentation for this class was generated from the following file:
- vendor/magento/zendframework1/library/Zend/Log.php