WC_Log_Handler_File::add()protectedWC 1.0

Add a log entry to chosen file.

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

Хуков нет.

Возвращает

true|false. True if write was successful.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->add( $entry, $handle );
$entry(строка) (обязательный)
Log entry text.
$handle(строка) (обязательный)
Log entry handle.

Код WC_Log_Handler_File::add() WC 8.7.0

protected function add( $entry, $handle ) {
	$result = false;

	if ( $this->should_rotate( $handle ) ) {
		$this->log_rotate( $handle );
	}

	if ( $this->open( $handle ) && is_resource( $this->handles[ $handle ] ) ) {
		$result = fwrite( $this->handles[ $handle ], $entry . PHP_EOL ); // @codingStandardsIgnoreLine.
	} else {
		$this->cache_log( $entry, $handle );
	}

	return false !== $result;
}