Skip to content

Instantly share code, notes, and snippets.

@PRElias
Created September 10, 2018 12:16
Show Gist options
  • Save PRElias/404b0a67b6c0dd0fb97559c72c0b6659 to your computer and use it in GitHub Desktop.
Save PRElias/404b0a67b6c0dd0fb97559c72c0b6659 to your computer and use it in GitHub Desktop.
Laravel log on browser
Route::get('/laravellog', function () {
$file = storage_path() . DIRECTORY_SEPARATOR . 'logs' . DIRECTORY_SEPARATOR . 'laravel.log';
$data = file($file);
$currentLine = count($data) - 1000;
if($currentLine < 0){
$currentLine = 0;
}
while($currentLine <= count($data) - 1){
echo $data[$currentLine] . "<br>";
$currentLine++;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment