Automattic\WooCommerce\Internal\Logging

RemoteLogger::handlepublicWC 1.0

Handle a log entry.

Method of the class: RemoteLogger{}

No Hooks.

Returns

true|false. False if value was not handled and true if value was handled.

Usage

$RemoteLogger = new RemoteLogger();
$RemoteLogger->handle( $timestamp, $level, $message, $context );
$timestamp(int) (required)
Log timestamp.
$level(string) (required)
emergency|alert|critical|error|warning|notice|info|debug.
$message(string) (required)
Log message.
$context(array) (required)
Additional information for log handlers.

RemoteLogger::handle() code WC 9.9.5

public function handle( $timestamp, $level, $message, $context ) {
	try {
		if ( ! $this->should_handle( $level, $message, $context ) ) {
			return false;
		}

		return $this->log( $level, $message, $context );
	} catch ( \Throwable $e ) {
		// Log the error to the local logger so we can investigate.
		SafeGlobalFunctionProxy::wc_get_logger()->error( 'Failed to handle the log: ' . $e->getMessage(), array( 'source' => 'remote-logging' ) );
		return false;
	}
}