* @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) */ namespace PrestaShop\Module\AutoUpgrade\Log; /** * This class retrieves all message to display during the upgrade / rollback tasks. */ abstract class Logger implements LoggerInterface { const DEBUG = 1; const INFO = 2; const NOTICE = 3; const WARNING = 4; const ERROR = 5; const CRITICAL = 6; const ALERT = 7; const EMERGENCY = 8; /** * @var string[] */ protected static $levels = [ self::DEBUG => 'DEBUG', self::INFO => 'INFO', self::NOTICE => 'NOTICE', self::WARNING => 'WARNING', self::ERROR => 'ERROR', self::CRITICAL => 'CRITICAL', self::ALERT => 'ALERT', self::EMERGENCY => 'EMERGENCY', ]; /** * @param array $context */ public function alert(string $message, array $context = []): void { $this->log(self::ALERT, $message, $context); } /** * @param array $context */ public function critical(string $message, array $context = []): void { $this->log(self::CRITICAL, $message, $context); } /** * @param array $context */ public function debug(string $message, array $context = []): void { $this->log(self::DEBUG, $message, $context); } /** * @param array $context */ public function emergency(string $message, array $context = []): void { $this->log(self::EMERGENCY, $message, $context); } /** * @param array $context */ public function error(string $message, array $context = []): void { $this->log(self::ERROR, $message, $context); } /** * @param array $context */ public function info(string $message, array $context = []): void { $this->log(self::INFO, $message, $context); } /** * @param array $context */ public function notice(string $message, array $context = []): void { $this->log(self::NOTICE, $message, $context); } /** * @param array $context */ public function warning(string $message, array $context = []): void { $this->log(self::WARNING, $message, $context); } /** * Equivalent of the old $nextErrors * Used during upgrade. Will be displayed in the top right panel (not visible at the beginning). * * @return string[] Details of error which occured during the request. Verbose levels: ERROR */ public function getErrors(): array { return []; } /** * Equivalent of the old $nextQuickInfo * Used during upgrade. Will be displayed in the lower panel. * * @return string[] Details on what happened during the execution. Verbose levels: DEBUG / INFO / WARNING */ public function getInfos(): array { return []; } /** * Return the last message stored with the INFO level. * Equivalent of the old $next_desc * Used during upgrade. Will be displayed on the top left panel. * * @return string Stores the main information about the current step */ public function getLastInfo(): string { return ''; } }