WooCommerce::log_errors()publicWC 3.2.0

Ensures fatal errors are logged so they can be picked up in the status report.

Метод класса: WooCommerce{}

Хуки из метода

Возвращает

null. Ничего.

Использование

$WooCommerce = new WooCommerce();
$WooCommerce->log_errors();

Список изменений

С версии 3.2.0 Введена.

Код WooCommerce::log_errors() WC 7.1.0

public function log_errors() {
	$error = error_get_last();
	if ( $error && in_array( $error['type'], array( E_ERROR, E_PARSE, E_COMPILE_ERROR, E_USER_ERROR, E_RECOVERABLE_ERROR ), true ) ) {
		$logger = wc_get_logger();
		$logger->critical(
			/* translators: 1: error message 2: file name and path 3: line number */
			sprintf( __( '%1$s in %2$s on line %3$s', 'woocommerce' ), $error['message'], $error['file'], $error['line'] ) . PHP_EOL,
			array(
				'source' => 'fatal-errors',
			)
		);

		/**
		 * Action triggered when there are errors during shutdown.
		 *
		 * @since 3.2.0
		 */
		do_action( 'woocommerce_shutdown_error', $error );
	}
}