howmuch515 icon

log.sh

howmuch515 | PRO | 10/11/19 07:28:45 AM UTC | 0 ⭐ | 232 👁️ | Never ⏰ | []
Bash |

600 B

|

None

|

0 👍

/

0 👎

#!/bin/sh
ESC="\033["
ESCEND=m
COLOR_OFF=${ESC}${ESCEND}
 
INFOMATION_COLOR=34
SUCCESS_COLOR=32
WARNING_COLOR=33
ERROR_COLOR=31
 
color() {
    col_code=$1
    msg=${@:4}
    msg_prefix=$2
    msg_suffix=$3
 
    printf "${ESC}${col_code};1${ESCEND}${msg_prefix} ${msg} ${msg_suffix}${COLOR_OFF}\n"
}
 
information() {
    msg=$1
    color ${INFOMATION_COLOR} "[+]" "" ${msg}
}
 
success() {
    msg=$1
    color ${SUCCESS_COLOR} "[*]" "" ${msg}
}
 
warning() {
    msg=$1
    color ${WARNING_COLOR} "[-]" "" ${msg}
}
 
error() {
    msg=$1
    color ${ERROR_COLOR} "[!]" "" ${msg}
}

Comments