WC_Log_Handler_File::get_log_filespublic staticWC 3.4.0

Get all log files in the log directory.

Method of the class: WC_Log_Handler_File{}

No Hooks.

Returns

Array.

Usage

$result = WC_Log_Handler_File::get_log_files();

Changelog

Since 3.4.0 Introduced.

WC_Log_Handler_File::get_log_files() code WC 9.9.5

public static function get_log_files() {
	$log_directory = LoggingUtil::get_log_directory();

	$files  = @scandir( $log_directory ); // @codingStandardsIgnoreLine.
	$result = array();

	if ( ! empty( $files ) ) {
		foreach ( $files as $key => $value ) {
			if ( ! in_array( $value, array( '.', '..' ), true ) ) {
				if ( ! is_dir( $value ) && strstr( $value, '.log' ) ) {
					$result[ sanitize_title( $value ) ] = $value;
				}
			}
		}
	}

	return $result;
}