WC_Log_Handler_File::handle()publicWC 1.0

Handle a log entry.

Метод класса: WC_Log_Handler_File{}

Хуков нет.

Возвращает

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) (обязательный)
Log timestamp.
$level(строка) (обязательный)
emergency|alert|critical|error|warning|notice|info|debug.
$message(строка) (обязательный)
Log message.
$context(массив) (обязательный)

Additional information for log handlers.

  • source(строка)
    Optional. Determines log file to write to.
    По умолчанию: 'log'

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

    По умолчанию: false

Код WC_Log_Handler_File::handle() WC 9.4.2

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 );
}