Skip to content

Instantly share code, notes, and snippets.

@barryvdh
Forked from jakebathman/logslaravel.sh
Last active September 7, 2018 03:01
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barryvdh/3790c881630475fd2f1ca93ccd35302a to your computer and use it in GitHub Desktop.
Save barryvdh/3790c881630475fd2f1ca93ccd35302a to your computer and use it in GitHub Desktop.
Tail Laravel logs and filter out the stack traces using https://deployer.org/
desc('Tail your laravel.log file');
task('tail', function () {
$numLines = isVerbose() ? '100' : '1000';
$tail = "tail -n {$numLines} {{deploy_path}}/current/storage/logs/laravel*.log ";
if (!isVerbose()) {
// Change -P to -E, depending on OS or grep version.
$tail .= '| grep -i -P "^\[\d{4}\-\d{2}\-\d{2} \d{2}:\d{2}:\d{2}\]|Next [\w\W]+?\:" | tail -n 100 ';
}
$output = run($tail);
writeln($output);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment