Created
May 4, 2021 08:01
-
-
Save jbfarez/b9db1bccafa72e39aa205200669d7673 to your computer and use it in GitHub Desktop.
Bash simple log function
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
logMe() { | |
local LIGHT_RED="\033[1;31m" | |
local LIGHT_GREEN="\033[1;32m" | |
local YELLOW="\033[0;33m" | |
local DELIM="\033[00m" | |
local LEVEL=$1 | |
local MSG=$2 | |
case ${LEVEL} in | |
info) | |
echo -e "${LIGHT_GREEN}[ info ]${DELIM} ${MSG}" | |
;; | |
warning) | |
echo -e "${YELLOW}[ warning ]${DELIM} ${MSG}" | |
;; | |
error) | |
echo -e "${LIGHT_RED}[ error ]${DELIM} ${MSG}" | |
;; | |
*) | |
echo -e "${LIGHT_RED}[ fatal ]${DELIM} logMe funciton called with a wrong argument" | |
;; | |
esac | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment