@@ -39,7 +39,14 @@ stderr_print() {
3939# None
4040# ########################
4141log () {
42- stderr_print " ${CYAN}${MODULE:- } ${MAGENTA} $( date " +%T.%2N " ) ${RESET}${* } "
42+ local color_bool=" ${BITNAMI_COLOR:- true} "
43+ # comparison is performed without regard to the case of alphabetic characters
44+ shopt -s nocasematch
45+ if [[ " $color_bool " = 1 || " $color_bool " =~ ^(yes| true)$ ]]; then
46+ stderr_print " ${CYAN}${MODULE:- } ${MAGENTA} $( date " +%T.%2N " ) ${RESET}${* } "
47+ else
48+ stderr_print " ${MODULE:- } $( date " +%T.%2N " ) ${* } "
49+ fi
4350}
4451# #######################
4552# Log an 'info' message
@@ -49,7 +56,14 @@ log() {
4956# None
5057# ########################
5158info () {
52- log " ${GREEN} INFO ${RESET} ==> ${* } "
59+ local msg_color=" "
60+ local color_bool=" ${BITNAMI_COLOR:- true} "
61+ # comparison is performed without regard to the case of alphabetic characters
62+ shopt -s nocasematch
63+ if [[ " $color_bool " = 1 || " $color_bool " =~ ^(yes| true)$ ]]; then
64+ msg_color=" $GREEN "
65+ fi
66+ log " ${msg_color} INFO ${RESET} ==> ${* } "
5367}
5468# #######################
5569# Log message
@@ -59,7 +73,14 @@ info() {
5973# None
6074# ########################
6175warn () {
62- log " ${YELLOW} WARN ${RESET} ==> ${* } "
76+ local msg_color=" "
77+ local color_bool=" ${BITNAMI_COLOR:- true} "
78+ # comparison is performed without regard to the case of alphabetic characters
79+ shopt -s nocasematch
80+ if [[ " $color_bool " = 1 || " $color_bool " =~ ^(yes| true)$ ]]; then
81+ msg_color=" $YELLOW "
82+ fi
83+ log " ${msg_color} WARN ${RESET} ==> ${* } "
6384}
6485# #######################
6586# Log an 'error' message
@@ -69,7 +90,14 @@ warn() {
6990# None
7091# ########################
7192error () {
72- log " ${RED} ERROR${RESET} ==> ${* } "
93+ local msg_color=" "
94+ local color_bool=" ${BITNAMI_COLOR:- true} "
95+ # comparison is performed without regard to the case of alphabetic characters
96+ shopt -s nocasematch
97+ if [[ " $color_bool " = 1 || " $color_bool " =~ ^(yes| true)$ ]]; then
98+ msg_color=" $RED "
99+ fi
100+ log " ${msg_color} ERROR${RESET} ==> ${* } "
73101}
74102# #######################
75103# Log a 'debug' message
@@ -81,12 +109,16 @@ error() {
81109# None
82110# ########################
83111debug () {
84- # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it
85- local bool =" ${BITNAMI_DEBUG :- false } "
112+ local msg_color= " "
113+ local color_bool =" ${BITNAMI_COLOR :- true } "
86114 # comparison is performed without regard to the case of alphabetic characters
87115 shopt -s nocasematch
88- if [[ " $bool " = 1 || " $bool " =~ ^(yes| true)$ ]]; then
89- log " ${MAGENTA} DEBUG${RESET} ==> ${* } "
116+ if [[ " $color_bool " = 1 || " $color_bool " =~ ^(yes| true)$ ]] ; then
117+ msg_color=" $MAGENTA "
118+ fi
119+ local debug_bool=" ${BITNAMI_DEBUG:- false} "
120+ if [[ " $debug_bool " = 1 || " $debug_bool " =~ ^(yes| true)$ ]]; then
121+ log " ${msg_color} DEBUG${RESET} ==> ${* } "
90122 fi
91123}
92124
0 commit comments