Error_Log::get_log_data()

Summary

Get data from log


Return

(array)


Source

File: src/BigCommerce/Logging/Error_Log.php

	public function get_log_data() {
		if ( file_exists( $this->log_path ) ) {
			if ( filesize( $this->log_path ) == 0 ) {
				return [
					'message'       => __( 'The log file is empty', 'bigcommerce' ),
					'log_content'   => '',
					'log_date_time' => '',
				];
			}
			$log_content            = file_get_contents( $this->log_path );
			$log_creation_date_time = date( "F-d-Y H:i:s.", filemtime( $this->log_path ) );

			return [
				'message'       => __( 'ok', 'bigcommerce' ),
				'log_content'   => $log_content,
				'log_date_time' => $log_creation_date_time,
			];
		} else {
			return [
				'message'       => __( 'Log not found -> ' . $this->log_path, 'bigcommerce' ),
				'log_content'   => '',
				'log_date_time' => '',
			];

		}
	}


User Contributed Notes

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