|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
#
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
0185bc |
# set -o noglob is assumed.
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
#
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
a43dbf |
exp_rtl_log_printf() {
|
|
Lucio Andrés Illanes Albornoz |
907bd3 |
local _attrs="${1}" _msg=""; shift; _msg="$(printf "${@}")";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
a43dbf |
if [ "${BUILD_IS_PARENT:-0}" -eq 1 ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
a43dbf |
printf "%s\n" "${_msg}" >> "${DEFAULT_BUILD_LOG_FNAME}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
a43dbf |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
a43dbf |
printf "\033[0m\033[${_attr}m%s\033[0m\n" "${_msg}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
a43dbf |
};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
a43dbf |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
ex_rtl_log_env_vars() {
|
|
Lucio Andrés Illanes Albornoz |
907bd3 |
local _nvar=1 _arg="" _arg_len_max=0;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
ex_rtl_log_msg info "Variables for this ${1:-build}:"; shift;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
while [ ${_nvar} -le ${#} ]; do
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
_arg="$(eval echo \${${_nvar}})";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
_arg="${_arg%%=*}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
if [ ${#_arg} -gt ${_arg_len_max} ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
_arg_len_max=${#_arg};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
fi; : $((_nvar+=1));
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
done;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
while [ ${#} -gt 0 ]; do
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
ex_rtl_log_msg info "$(printf \
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
"%${_arg_len_max}.${_arg_len_max}s=%s" \
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
"${1%%=*}" "$(ex_rtl_get_var_unsafe ${1#*=})")";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
shift;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
done;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
ex_rtl_log_set_vnfo_lvl() {
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
EXP_RTL_LOG_VNFO_LVL="${1}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
ex_rtl_log_msg() {
|
|
Lucio Andrés Illanes Albornoz |
584601 |
local _lvl="${1}" _lvl_uc="" _attr=""; shift;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
648b81 |
if [ "${_lvl}" = vnfo ]\
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
5c1ec1 |
|| [ "${_lvl}" = vucc ]\
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
&& [ "${EXP_RTL_LOG_VNFO_LVL:-0}" -lt 1 ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
return;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
648b81 |
elif [ "${_lvl}" = vvfo ]\
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
&& [ "${EXP_RTL_LOG_VNFO_LVL:-0}" -lt 2 ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
648b81 |
return;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
648b81 |
elif [ "${_lvl}" = vvvo ]\
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
ec19f0 |
&& [ "${EXP_RTL_LOG_VNFO_LVL:-0}" -lt 3 ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
648b81 |
return;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
fi;
|
|
Lucio Andrés Illanes Albornoz |
584601 |
_lvl_uc="$(ex_rtl_toupper "${_lvl%exit}")";
|
|
Lucio Andrés Illanes Albornoz |
584601 |
_attr="$(ex_rtl_get_var_unsafe "DEFAULT_LOG_MSG_${_lvl_uc}_COLOUR")";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
if [ ${#} -gt 1 ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
a43dbf |
exp_rtl_log_printf "${_attrs}" "==> %s %s %s" "$(ex_rtl_date)" "${1}" "$*";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
else
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
a43dbf |
exp_rtl_log_printf "${_attrs}" "==> %s %s" "$(ex_rtl_date)" "${1}";
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
a43dbf |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
a43dbf |
if [ ${_lvl} = failexit ]; then
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
a43dbf |
exit 1;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
a43dbf |
else
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
a43dbf |
return 0;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
a43dbf |
fi;
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
};
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
|
|
Lucio Andrés Illanes Albornoz (arab, vxp) |
32ad21 |
# vim:filetype=sh
|