Automattic\WooCommerce\Internal\PushNotifications\Services
DriverAvailabilityService::write_log
Writes the log entry for a swallowed throwable.
Method of the class: DriverAvailabilityService{}
No Hooks.
Returns
void. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->write_log( $message, $e, ?LegacyProxy $proxy ): void;
- $message(string) (required)
- The message describing what was being determined.
- $e(Throwable) (required)
- The caught throwable.
- ?LegacyProxy $proxy
- .
Default:null
DriverAvailabilityService::write_log() DriverAvailabilityService::write log code WC 11.3.0
private function write_log( string $message, Throwable $e, ?LegacyProxy $proxy = null ): void {
$proxy = $proxy ?? wc_get_container()->get( LegacyProxy::class );
$logger = $proxy->call_function( 'wc_get_logger' );
if ( ! $logger instanceof WC_Logger_Interface ) {
return;
}
$logger->error(
sprintf(
'%s (%s): %s',
$message,
$e instanceof Error ? 'error' : 'exception',
$e->getMessage()
),
array( 'source' => PushNotifications::FEATURE_NAME )
);
}