WordPress at Your Fingertips
function is not described

WC_Log_Handler_File::handle() public WC 1.0

Handle a log entry.

{} It's a method of the class: WC_Log_Handler_File{}

No Hooks.


true|false. False if value was not handled and true if value was handled.


$WC_Log_Handler_File = new WC_Log_Handler_File();
$WC_Log_Handler_File->handle( $timestamp, $level, $message, $context );
$timestamp(int) (required)
Log timestamp.
$level(string) (required)
$message(string) (required)
Log message.
$context(array) (required)

Additional information for log handlers.

  • source(string)
    Optional. Determines log file to write to.
    Default: 'log'

  • _legacy(true|false)
    Optional. True to use outdated log format
    originally used in deprecated WC_Logger::add calls.

    Default: false

Code of WC_Log_Handler_File::handle() WC 5.8.0

public function handle( $timestamp, $level, $message, $context ) {

	if ( isset( $context['source'] ) && $context['source'] ) {
		$handle = $context['source'];
	} else {
		$handle = 'log';

	$entry = self::format_entry( $timestamp, $level, $message, $context );

	return $this->add( $entry, $handle );