Created
September 10, 2018 12:16
-
-
Save PRElias/404b0a67b6c0dd0fb97559c72c0b6659 to your computer and use it in GitHub Desktop.
Laravel log on browser
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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