Last active
December 23, 2015 18:29
-
-
Save ZeroDragon/6676563 to your computer and use it in GitHub Desktop.
A small bash script to add syntax colors to a php.log
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
#!/bin/bash | |
func (){ | |
local BLACK=`echo -en '\e[30m'` | |
local RED=`echo -en '\e[31m'` | |
local GREEN=`echo -en '\e[32m'` | |
local YELLOW=`echo -en '\e[33m'` | |
local BLUE=`echo -en '\e[34m'` | |
local MAGENTA=`echo -en '\e[35m'` | |
local CYAN=`echo -en '\e[36m'` | |
local WHITE=`echo -en '\e[37m'` | |
local RESET=`echo -en '\e[00m'` | |
local GREP="" | |
GREP="$GREP s/(\[|.*\])/$YELLOW\1$RESET/g;" | |
GREP="$GREP s/(\[33m\[)(.*)(UTC\])/$MAGENTA\2$RESET/g;" | |
GREP="$GREP s/(\(|\))/$BLUE\1$RESET/g;" | |
GREP="$GREP s/(Array|stdClass Object)/$BLUE\1$RESET/g;" | |
GREP="$GREP s/(=>)/$GREEN\1$RESET/g" | |
tail -f /path/to/your/php_error.log | sed -E $GREP | |
} | |
func |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here is a Before and After screenshot