WC_Log_Handler_File::add()protectedWC 1.0

Add a log entry to chosen file.

Method of the class: WC_Log_Handler_File{}

No Hooks.

Return

true|false. True if write was successful.

Usage

// protected - for code of main (parent) or child class
$result = $this->add( $entry, $handle );
$entry(string) (required)
Log entry text.
$handle(string) (required)
Log entry handle.

WC_Log_Handler_File::add() code 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;
}