label = __( 'Debug logs', 'health-check' ); $this->description = __( 'The details below are gathered from your debug.log file, and is displayed because the WP_DEBUG_LOG constant has been set to allow logging of warnings and errors.', 'health-check' ); parent::__construct(); } private function read_debug_log() { if ( ! defined( 'WP_DEBUG_LOG' ) || false === WP_DEBUG_LOG ) { return ''; } $logfile = WP_DEBUG_LOG; /* * `WP_DEBUG_LOG` can be a boolean value, or a path to a file. * In the case of a boolean value of `true`, the default file location path will be used. */ if ( is_bool( $logfile ) ) { $logfile = WP_CONTENT_DIR . '/debug.log'; } if ( ! file_exists( $logfile ) ) { return ''; } $debug_log = @file_get_contents( $logfile ); if ( false === $debug_log ) { return sprintf( // translators: %s: The path to the debug log file. __( 'The debug log file found at `%s`, could not be read.', 'health-check' ), $logfile ); } return $debug_log; } public function tab_content() { if ( ! defined( 'WP_DEBUG_LOG' ) || false === WP_DEBUG_LOG ) : printf( '

%s

', __( 'Because the WP_DEBUG_LOG constant is not set to allow logging of errors and warnings, and there is therefore no more details here.', 'health-check' ) ); printf( '

%s

', sprintf( // translators: %s: The URL to the Debugging in WordPress article. __( 'You can read more about the WP_DEBUG_LOG constant, and how to enable it, in the Debugging in WordPress article.', 'health-check' ), // translators: The localized URL to the Debugging in WordPress article, if available. __( 'https://wordpress.org/documentation/article/debugging-in-wordpress/#wp_debug_log', 'health-check' ) ) ); ?>