WC_Log_Handler_DB::handle
Handle a log entry.
Метод класса: WC_Log_Handler_DB{}
Хуков нет.
Возвращает
true|false. False if value was not handled and true if value was handled.
Использование
$WC_Log_Handler_DB = new WC_Log_Handler_DB(); $WC_Log_Handler_DB->handle( $timestamp, $level, $message, $context );
- $timestamp(int) (обязательный)
- Log timestamp.
- $level(строка) (обязательный)
- emergency|alert|critical|error|warning|notice|info|debug.
- $message(строка) (обязательный)
- Log message.
- $context(массив) (обязательный)
Additional information for log handlers.
- source(строка)
Optional. Source will be available in log table. If no source is provided, attempt to provide sensible default.
- source(строка)
Заметки
- Смотрите: WC_Log_Handler_DB::get_log_source() for default source.
Код WC_Log_Handler_DB::handle() WC Log Handler DB::handle WC 10.8.1
public function handle( $timestamp, $level, $message, $context ) {
if ( isset( $context['source'] ) && $context['source'] ) {
$source = $context['source'];
} else {
$source = $this->get_log_source();
}
// Clear the source cache if this is a new source.
$cached_sources = get_option( WC_Admin_Log_Table_List::SOURCE_CACHE_OPTION_KEY, array() );
if ( ! in_array( $source, $cached_sources, true ) ) {
delete_option( WC_Admin_Log_Table_List::SOURCE_CACHE_OPTION_KEY );
}
return $this->add( $timestamp, $level, $message, $source, $context );
}