Wordpress: Fatal error: Trait "YoastSEO_Vendor\Psr\Log\LoggerTrait" not found

53 views Asked by At

I was trying to restore the backup blog, but when I restored, this message appeared when I tried to access any page, including admin.

Wordpress version: 6.3.1

PHP version: 7.3.33

Fatal error: Trait 'YoastSEO_Vendor\Psr\Log\LoggerTrait' not found in /wp-content/plugins/wordpress-seo/src/loggers/logger.php on line 14

logger.php->line 14:

use LoggerTrait;

the complete logger.php file:

<?php

namespace Yoast\WP\SEO\Loggers;

use YoastSEO_Vendor\Psr\Log\LoggerInterface;
use YoastSEO_Vendor\Psr\Log\LoggerTrait;
use YoastSEO_Vendor\Psr\Log\NullLogger;

/**
 * Our logger class.
 */
class Logger implements LoggerInterface {

    use LoggerTrait;

    /**
     * The logger object.
     *
     * @var LoggerInterface
     */
    protected $wrapped_logger;

    /**
     * Logger constructor.
     */
    public function __construct() {
        $this->wrapped_logger = new NullLogger();

        /**
         * Gives the possibility to set override the logger interface.
         *
         * @api \YoastSEO_Vendor\Psr\Log\LoggerInterface $logger Instance of NullLogger.
         *
         * @return LoggerInterface The logger object.
         */
        $this->wrapped_logger = \apply_filters( 'wpseo_logger', $this->wrapped_logger );
    }

    /**
     * Logs with an arbitrary level.
     *
     * @param mixed  $level   The log level.
     * @param string $message The log message.
     * @param array  $context The log context.
     *
     * @return void
     */
    public function log( $level, $message, array $context = [] ) {
        $this->wrapped_logger->log( $level, $message, $context );
    }
}

I don't understand what happened because it was working normally before restoring the backup

0

There are 0 answers