![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/dev/tests/integration/framework/Magento/TestFramework/ErrorLog/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); namespace Magento\TestFramework\ErrorLog; use Magento\Framework\Logger\Monolog; use Monolog\Handler\HandlerInterface; use Monolog\DateTimeImmutable; class Logger extends Monolog { /** * @var array */ protected $messages = []; /** * Minimum error level to log message * Possible values: -1 ignore all errors, * and level constants form http://tools.ietf.org/html/rfc5424 standard * * @var int */ protected $minimumErrorLevel; /** * @param string $name The logging channel * @param HandlerInterface[] $handlers Optional stack of handlers, the first one in the array is called first, etc * @param callable[] $processors Optional array of processors */ public function __construct( string $name, array $handlers = [], array $processors = [] ) { $this->minimumErrorLevel = defined('TESTS_ERROR_LOG_LISTENER_LEVEL') ? TESTS_ERROR_LOG_LISTENER_LEVEL : -1; parent::__construct($name, $handlers, $processors); } /** * Clear messages * * @return void */ public function clearMessages(): void { $this->messages = []; } /** * Get messages * * @return array */ public function getMessages(): array { return $this->messages; } /** * @inheritdoc * * @param int $level The logging level * @param string $message The log message * @param array $context The log context * @param DateTimeImmutable $datetime Optional log date to log into the past or future * @return bool Whether the record has been processed */ public function addRecord( int $level, string $message, array $context = [], DateTimeImmutable $datetime = null ): bool { if ($level <= $this->minimumErrorLevel) { $this->messages[] = [ 'level' => $this->getLevelName($level), 'message' => $message, ]; } return parent::addRecord($level, $message, $context, $datetime); } }