Automattic\WooCommerce\Internal\PushNotifications\Services
NotificationStepLogger::log_batch_step
Records a step that covers several notifications at once, such as the single loopback request a batch is sent in.
Written under the module's own source, since a batch can span notification types and so belongs to no one type's source. The notifications it covers are named by identifier in the context.
Метод класса: NotificationStepLogger{}
Хуков нет.
Возвращает
void. Ничего (null).
Использование
$NotificationStepLogger = new NotificationStepLogger(); $NotificationStepLogger->log_batch_step( $step, $outcome, $context ): void;
- $step(строка) (обязательный)
- Machine-readable step name, e.g.
loopback_requested. - $outcome(строка) (обязательный)
- Machine-readable outcome, e.g.
ok. - $context(массив)
- Extra fields to store with the line.
По умолчанию:array()
Список изменений
| С версии 11.3.0 | Введена. |
Код NotificationStepLogger::log_batch_step() NotificationStepLogger::log batch step WC 11.3.0
public function log_batch_step( string $step, string $outcome, array $context = array() ): void {
try {
if ( ! $this->is_active() ) {
return;
}
$context['step'] = $step;
$context['outcome'] = $outcome;
$context['source'] = PushNotifications::FEATURE_NAME;
$context['remote-logging'] = false;
wc_get_logger()->info( self::format_message( $step, $outcome ), self::bound( $context ) );
} catch ( Throwable $e ) { // phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch
// Deliberately ignored: a logging failure must not affect the send.
}
}