/
githubmirror
/
magento2
Обзор
Документация
Войти
/
githubmirror
/
magento2
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
2.4-develop
lib/internal/Magento/Framework/Setup/ConsoleLogger.php
105 строк
2 KB
Alexandra Zota
ACP2E-4019: CE copyright updates for 2.4.9-beta1
22 окт 2025, 17:47
22 окт 2025, 17:47
1b769b7
Код
Авторство
О чём код?
<?php /** * Copyright 2015 Adobe * All Rights Reserved. */ namespace Magento\Framework\Setup; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Formatter\OutputFormatterStyle; class ConsoleLogger implements ConsoleLoggerInterface { /** * Indicator of whether inline output is started * * @var bool */ private $isInline = false; /** * @var OutputInterface */ protected $console; /** * Constructor * * @param OutputInterface $output */ public function __construct(OutputInterface $output) { $this->console = $output; $outputFormatter = $this->console->getFormatter(); $outputFormatter->setStyle('detail', new OutputFormatterStyle('blue')); $outputFormatter->setStyle('metadata', new OutputFormatterStyle('cyan')); } /** * @inheritdoc */ public function logSuccess($message) { $this->terminateLine(); $this->console->writeln("<info>[SUCCESS]" . ($message ? ": $message" : '') . '</info>'); } /** * @inheritdoc */ public function logError(\Exception $e) { $this->terminateLine(); $this->console->writeln("<error>[ERROR]: " . $e . '</error>'); } /** * @inheritdoc */ public function log($message) { $this->terminateLine(); $this->console->writeln('<detail>' . $message . '</detail>'); } /** * @inheritdoc */ public function logInline($message) { $this->isInline = true; $this->console->write('<detail>' . $message . '</detail>'); } /** * @inheritdoc */ public function logMeta($message) { $this->terminateLine(); $this->console->writeln('<metadata>' . $message . '</metadata>'); } /** * @inheritdoc */ public function logMetaInline($message) { $this->isInline = true; $this->console->write('<metadata>' . $message . '</metadata>'); } /** * Terminates line if the inline logging is started * * @return void */ private function terminateLine() { if ($this->isInline) { $this->isInline = false; $this->console->writeln(''); } } }