Install ccze:
sudo apt update
sudo apt install ccze
View the log:
tail -f storage/logs/laravel.log | ccze -A
You can use grep with the --color option to highlight specific terms:
tail -f storage/logs/laravel.log | grep --color=always -E "ERROR|INFO|DEBUG|NOTICE|$"
Create a custom highlighting script:
tail -f storage/logs/laravel.log | awk '
/ERROR/ {print "\033[31m" $0 "\033[0m"}
/INFO/ {print "\033[32m" $0 "\033[0m"}
/DEBUG/ {print "\033[34m" $0 "\033[0m"}
/NOTICE/ {print "\033[33m" $0 "\033[0m"}
!/ERROR|INFO|DEBUG|NOTICE/ {print $0}
'
Tips:
- Replace the log file path if it differs.
- Customize colors using ANSI codes (31 for red, 32 for green, etc.).