Automattic\WooCommerce\Internal\Logging
RemoteLogger::should_handle()
Determine whether to handle or ignore log.
Метод класса: RemoteLogger{}
Хуков нет.
Возвращает
true|false
. True if the log should be handled.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->should_handle( $level, $message, $context );
- $level(строка) (обязательный)
- emergency|alert|critical|error|warning|notice|info|debug.
- $message(строка) (обязательный)
- Log message to be recorded.
- $context(массив) (обязательный)
- Additional information for log handlers.
Код RemoteLogger::should_handle() RemoteLogger::should handle WC 9.3.3
protected function should_handle( $level, $message, $context ) { if ( ! $this->is_remote_logging_allowed() ) { return false; } // Ignore logs that are less severe than critical. This is temporary to prevent sending too many logs to the remote logging service. We can consider remove this if the remote logging service can handle more logs. if ( WC_Log_Levels::get_level_severity( $level ) < WC_Log_Levels::get_level_severity( WC_Log_Levels::CRITICAL ) ) { return false; } if ( $this->is_third_party_error( (string) $message, (array) $context ) ) { return false; } if ( WC_Rate_Limiter::retried_too_soon( self::RATE_LIMIT_ID ) ) { error_log( 'Remote logging throttled.' ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log return false; } return true; }