Last active
August 29, 2015 14:10
-
-
Save itsamenathan/1617f67d63526fa1aeab to your computer and use it in GitHub Desktop.
bash logging functions
This file contains hidden or 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
# Colors | |
ESC_SEQ="\x1b[" | |
COL_RESET=$ESC_SEQ"39;49;00m" | |
COL_RED=$ESC_SEQ"31;01m" | |
COL_GREEN=$ESC_SEQ"32;01m" | |
COL_YELLOW=$ESC_SEQ"33;01m" | |
COL_BLUE=$ESC_SEQ"34;01m" | |
COL_MAGENTA=$ESC_SEQ"35;01m" | |
COL_CYAN=$ESC_SEQ"36;01m" | |
function log_info(){ | |
NOW=$(date +"%Y-%m-%d %H:%M:%S") | |
echo -e "$NOW -$COL_GREEN INFO $COL_RESET- $1" | |
} | |
function log_error(){ | |
NOW=$(date +"%Y-%m-%d %H:%M:%S") | |
echo -e "$NOW -$COL_RED ERROR $COL_RESET- $1" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment