WC_Logger::log() public WC 1.0
Add a log entry.
{} Это метод класса: WC_Logger{}
Хуки из метода
Возвращает
Null. Ничего.
Использование
$WC_Logger = new WC_Logger(); $WC_Logger->log( $level, $message, $context );
- $level(строка) (обязательный)
- One of the following:
php 'emergency': System is unusable. 'alert': Action must be taken immediately. 'critical': Critical conditions. 'error': Error conditions. 'warning': Warning conditions. 'notice': Normal but significant condition. 'info': Informational messages. 'debug': Debug-level messages.
- $message(строка) (обязательный)
- Log message.
- $context(массив)
- Additional information for log handlers.
Код WC_Logger::log() WC Logger::log WC 5.0.0
public function log( $level, $message, $context = array() ) {
if ( ! WC_Log_Levels::is_valid_level( $level ) ) {
/* translators: 1: WC_Logger::log 2: level */
wc_doing_it_wrong( __METHOD__, sprintf( __( '%1$s was called with an invalid level "%2$s".', 'woocommerce' ), '<code>WC_Logger::log</code>', $level ), '3.0' );
}
if ( $this->should_handle( $level ) ) {
$timestamp = current_time( 'timestamp', 1 );
$message = apply_filters( 'woocommerce_logger_log_message', $message, $level, $context );
foreach ( $this->handlers as $handler ) {
$handler->handle( $timestamp, $level, $message, $context );
}
}
}