WC_Log_Handler_File::get_log_file_name()public staticWC 3.3

Get a log file name.

File names consist of the handle, followed by the date, followed by a hash, .log.

Method of the class: WC_Log_Handler_File{}

No Hooks.

Return

true|false|String. The log file name or false if cannot be determined.

Usage

$result = WC_Log_Handler_File::get_log_file_name( $handle );
$handle(string) (required)
Log name.

Changelog

Since 3.3 Introduced.

WC_Log_Handler_File::get_log_file_name() code WC 8.7.0

public static function get_log_file_name( $handle ) {
	if ( function_exists( 'wp_hash' ) ) {
		$date_suffix = date( 'Y-m-d', time() );
		$hash_suffix = wp_hash( $handle );
		return sanitize_file_name( implode( '-', array( $handle, $date_suffix, $hash_suffix ) ) . '.log' );
	} else {
		wc_doing_it_wrong( __METHOD__, __( 'This method should not be called before plugins_loaded.', 'woocommerce' ), '3.3' );
		return false;
	}
}