WC_Log_Handler_DB::handle()
Handle a log entry.
Method of the class: WC_Log_Handler_DB{}
No Hooks.
Return
true|false
. False if value was not handled and true if value was handled.
Usage
$WC_Log_Handler_DB = new WC_Log_Handler_DB(); $WC_Log_Handler_DB->handle( $timestamp, $level, $message, $context );
- $timestamp(int) (required)
- Log timestamp.
- $level(string) (required)
- emergency|alert|critical|error|warning|notice|info|debug.
- $message(string) (required)
- Log message.
- $context(array) (required)
Additional information for log handlers.
- source(string)
Optional. Source will be available in log table. If no source is provided, attempt to provide sensible default.
- source(string)
Notes
- See: WC_Log_Handler_DB::get_log_source() for default source.
WC_Log_Handler_DB::handle() WC Log Handler DB::handle code WC 9.8.2
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 ); }