121 $r =
new ReflectionClass($this);
122 $this->_priorities = array_flip($r->getConstants());
124 if ($writer !==
null) {
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);
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);
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");
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');
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.' 314 #require_once 'Zend/Log/Exception.php'; 319 $namespace = $defaultNamespace;
326 if (substr($namespace, -1) ==
'\\') {
331 if (strlen($namespace) === 0) {
347 return array_merge(array(
348 'timestamp' => date($this->_timestampFormat),
350 'priority' => $priority,
351 'priorityName' => $this->_priorities[$priority]
362 public function __destruct()
365 foreach($this->_writers as $writer) {
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'; 416 public function log(
$message, $priority, $extras =
null)
419 if (empty($this->_writers)) {
421 #require_once 'Zend/Log/Exception.php'; 425 if (! isset($this->_priorities[$priority])) {
427 #require_once 'Zend/Log/Exception.php'; 435 if (!empty($extras)) {
437 if (is_array($extras)) {
438 foreach ($extras as $key =>
$value) {
439 if (is_string($key)) {
449 $event[
'info'] =
$info;
455 foreach ($this->_filters as $filter) {
456 if (! $filter->accept($event)) {
463 foreach ($this->_writers as $writer) {
464 $writer->write($event);
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;
503 if (is_int($filter)) {
505 #require_once 'Zend/Log/Filter/Priority.php'; 513 #require_once 'Zend/Log/Exception.php'; 517 $this->_filters[] = $filter;
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;
557 $this->_extras = array_merge($this->_extras, array(
$name =>
$value));
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;
622 public function errorHandler($errno, $errstr, $errfile, $errline, $errcontext)
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);
649 $this->_timestampFormat =
$format;
$_defaultFormatterNamespace
setEventItem($name, $value)
elseif(isset( $params[ 'redirect_parent']))
static loadClass($class, $dirs=null)
call_user_func($callable, $param)
errorHandler($errno, $errstr, $errfile, $errline, $errcontext)
_constructFormatterFromConfig($config)
$_option $_optionId $class
_constructFilterFromConfig($config)
__construct(Zend_Log_Writer_Abstract $writer=null)
_constructFromConfig($type, $config, $namespace)
static factory($config=array())
setTimestampFormat($format)
getClassName($config, $type, $defaultNamespace)
foreach( $_productCollection as $_product)() ?>" class $info
_packEvent($message, $priority)
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
addPriority($name, $priority)
_constructWriterFromConfig($config)
if(!isset($_GET['name'])) $name