File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44declare -A VARS
55
66function _early_variables_setup() {
7- __environment_variables_log_level
7+ __ensure_valid_log_level
88 __environment_variables_from_files
99 _obtain_hostname_and_domainname
1010 __environment_variables_backwards_compatibility
@@ -181,21 +181,11 @@ function __environment_variables_general_setup() {
181181 fi
182182}
183183
184- function __environment_variables_log_level() {
185- if [[ ${LOG_LEVEL} == ' trace' ]] \
186- || [[ ${LOG_LEVEL} == ' debug' ]] \
187- || [[ ${LOG_LEVEL} == ' info' ]] \
188- || [[ ${LOG_LEVEL} == ' warn' ]] \
189- || [[ ${LOG_LEVEL} == ' error' ]]
190- then
191- return 0
192- else
193- local DEFAULT_LOG_LEVEL=' info'
194- _log ' warn' " Log level '${LOG_LEVEL} ' is invalid (falling back to default '${DEFAULT_LOG_LEVEL} ')"
195-
196- # shellcheck disable=SC2034
197- VARS[LOG_LEVEL]=" ${DEFAULT_LOG_LEVEL} "
198- LOG_LEVEL=" ${DEFAULT_LOG_LEVEL} "
184+ # `LOG_LEVEL` must be set early to correctly filter calls to `scripts/helpers/log.sh:_log()`
185+ function __ensure_valid_log_level() {
186+ if [[ ! ${LOG_LEVEL:- info} =~ ^(trace| debug| info| warn| error)$ ]]; then
187+ _log ' warn' " Log level '${LOG_LEVEL} ' is invalid (falling back to default: 'info')"
188+ LOG_LEVEL=' info'
199189 fi
200190}
201191
You can’t perform that action at this time.
0 commit comments