WC_Log_Handler_File::should_rotate( string $handle )

Check if log file should be rotated.


Description Description

Compares the size of the log file to determine whether it is over the size limit.


Parameters Parameters

$handle

(Required) Log handle.


Top ↑

Return Return

(bool) True if if should be rotated.


Top ↑

Source Source

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

	protected function should_rotate( $handle ) {
		$file = self::get_log_file_path( $handle );
		if ( $file ) {
			if ( $this->is_open( $handle ) ) {
				$file_stat = fstat( $this->handles[ $handle ] );
				return $file_stat['size'] > $this->log_size_limit;
			} elseif ( file_exists( $file ) ) {
				return filesize( $file ) > $this->log_size_limit;
			} else {
				return false;
			}
		} else {
			return false;
		}
	}


Top ↑

User Contributed Notes User Contributed Notes

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