WC_Log_Handler_File::add( string $entry, string $handle )

Add a log entry to chosen file.


Description Description


Parameters Parameters

$entry

(Required) Log entry text.

$handle

(Required) Log entry handle.


Top ↑

Return Return

(bool) True if write was successful.


Top ↑

Source Source

File: includes/log-handlers/class-wc-log-handler-file.php

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


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.