File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ customized_label=false
1717nolabel=false
1818noappname=false
1919noadjust=false
20+ output=" stdout"
2021
2122_help () {
2223 echo " usage ${0} [option] [type] [message]"
@@ -123,24 +124,28 @@ case ${1} in
123124 " info" )
124125 msg_type=" type"
125126 textcolor=" 32"
127+ output=" stdout"
126128 [[ " ${customized_label} " = false ]] && msg_label=" Info"
127129 shift 1
128130 ;;
129131 " warn" )
130132 msg_type=" warn"
131133 textcolor=" 33"
134+ output=" stdout"
132135 [[ " ${customized_label} " = false ]] && msg_label=" Warning"
133136 shift 1
134137 ;;
135138 " debug" )
136139 msg_type=" debug"
137140 textcolor=" 35"
141+ output=" stdout"
138142 [[ " ${customized_label} " = false ]] && msg_label=" Debug"
139143 shift 1
140144 ;;
141145 " error" )
142146 msg_type=" error"
143147 textcolor=" 31"
148+ output=" stderr"
144149 [[ " ${customized_label} " = false ]] && msg_label=" Error"
145150 shift 1
146151 ;;
@@ -186,4 +191,16 @@ echo_message() {
186191 echo -ne " ${message} \n"
187192}
188193
189- echo ${echo_opts} " $( echo_appname) $( echo_type) $( echo_message) "
194+ full_message=" $( echo_appname) $( echo_type) $( echo_message) "
195+
196+ case " ${output} " in
197+ " stdout" )
198+ echo ${echo_opts} " ${full_message} " >&1
199+ ;;
200+ " stderr" )
201+ echo ${echo_opts} " ${full_message} " >&2
202+ ;;
203+ * )
204+ echo ${echo_opts} " ${full_message} " > ${output}
205+ ;;
206+ esac
You can’t perform that action at this time.
0 commit comments