Skip to content

Instantly share code, notes, and snippets.

@gedex
Last active May 3, 2016 12:13
Show Gist options
  • Save gedex/0f465c9dba7bf5261a7d55b9cd770a6d to your computer and use it in GitHub Desktop.
Save gedex/0f465c9dba7bf5261a7d55b9cd770a6d to your computer and use it in GitHub Desktop.
Colorized PHP logs via tail
coloirzed_tail() {
tail -100f $1 | awk '
/PHP Fatal/ {print "\033[1;31m" $0 "\033[39m"; next}
/WordPress database error/ {print "\033[1;31m" $0 "\033[39m"; next}
/PHP Notice/ {print "\033[1;33m" $0 "\033[39m"; next}
/PHP Warning/ {print "\033[1;33m" $0 "\033[39m"; next}
1 {print}
'
}
alias tlog="coloirzed_tail /srv/log/php_errors.log"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment