Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel reading log file

use IlluminateSupportFacadesFile;
use CarbonCarbon;

$date = new Carbon($request->get('date', today()));
$filePath = storage_path("logs/laravel-{$date->format('Y-m-d')}.log");
$data = [];
if (File::exists($filePath)) {
	$data = [
		'lastModified' => new Carbon(File::lastModified($filePath)),
		'size' => File::size($filePath),
		'file' => File::get($filePath),
	];
}
return $data;
Source by medium.com #
 
PREVIOUS NEXT
Tagged: #laravel #reading #log #file
ADD COMMENT
Topic
Name
6+2 =