File tree Expand file tree Collapse file tree 1 file changed +11
-11
lines changed
Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -765,6 +765,13 @@ range_arg(){
765765#! /bin/bash
766766
767767
768+ if ! command -v stecho & > /dev/null ; then
769+ # # Fallback to printf in case stecho is unavailable.
770+ stecho () {
771+ printf " %s\n" " $@ "
772+ }
773+ fi
774+
768775# # Logging mechanism with easy customization of message format as well as
769776# # standardization on how the messages are delivered.
770777# # usage: log [info|notice|warn|error] "X occurred."
@@ -819,13 +826,10 @@ log(){
819826 # # error logs are the minimum and should always be printed, even if
820827 # # failing to assign a correct log type
821828 # # send bugs and error to stdout and stderr
829+ log_full=" ${log_source_script}${log_level_colorized}${log_content} "
822830 case " ${log_type} " in
823- bug)
824- printf ' %s%b%s\n' " ${log_source_script} " " ${log_level_colorized} " " ${log_content} " >&2
825- return 0
826- ;;
827- error)
828- printf ' %s%b%s\n' " ${log_source_script} " " ${log_level_colorized} " " ${log_content} " >&2
831+ bug|error)
832+ stecho " ${log_full} " >&2
829833 return 0
830834 ;;
831835 null)
@@ -839,15 +843,11 @@ log(){
839843 | grep -q " ${log_type} "
840844 then
841845 case " ${log_type} " in
842- warn)
843- # # send warning to stdout and stderr
844- printf ' %s%b%s\n' " ${log_source_script} " " ${log_level_colorized} " " ${log_content} " >&2
845- ;;
846846 null)
847847 true
848848 ;;
849849 * )
850- printf ' %s%b%s\n ' " ${log_source_script} " " ${log_level_colorized} " " ${log_content }" >&2
850+ stecho " ${log_full } " >&2
851851 ;;
852852 esac
853853 fi
You can’t perform that action at this time.
0 commit comments