Automattic\WooCommerce\Internal\Logging

SafeGlobalFunctionProxy::log_wrapper_error()protected staticWC 1.0

Log wrapper function errors to "local logging" for debugging.

Method of the class: SafeGlobalFunctionProxy{}

No Hooks.

Return

null. Nothing (null).

Usage

$result = SafeGlobalFunctionProxy::log_wrapper_error( $function_name, $error_message, $context );
$function_name(string) (required)
The name of the wrapped function.
$error_message(string) (required)
The error message.
$context(array)
Additional context for the error.
Default: array()

SafeGlobalFunctionProxy::log_wrapper_error() code WC 9.6.1

protected static function log_wrapper_error( $function_name, $error_message, $context = array() ) {
	self::maybe_load_missing_function( 'wc_get_logger' );

	wc_get_logger()->error(
		'[Wrapper function error] ' . sprintf( 'Error in %s: %s', $function_name, $error_message ),
		array_merge(
			array(
				'function' => $function_name,
				'source'   => 'remote-logging',
			),
			$context
		)
	);
}