add debug option -d

merge-requests/260/head
Bernhard Landauer 7 years ago
parent 4599ed61c8
commit 6d41d0a464

@ -24,6 +24,9 @@ import ${LIBDIR}/util-disk.sh
[[ ! -e ~/.dialogrc ]] && [[ -e /etc/skel/.dialogrc ]] && cp /etc/skel/.dialogrc ~/.dialogrc
# run in debug mode with -d option
[[ $1 == "-d" ]] && declare -i debug=1
id_system
select_language
mk_connection

@ -164,15 +164,17 @@ check_for_error() {
# and function varsdump ? _msg="$_msg \n $(declare -p | grep -v " _")"
local _fpath="${FUNCNAME[*]:1:2}()"
_fpath=" --${_fpath// /()<-}"
echo -e "$(date +%D\ %T) ERROR ${_msg} ${_fpath}" >> "${LOGFILE}"
! ((debug)) && _fpath=""
echo -e "$(date +%D\ %T) ERROR ${_msg}${_fpath}" >> "${LOGFILE}"
if [[ "${_function_menu}" != "SKIP" ]]; then
DIALOG " $_ErrTitle " --msgbox "\n${_msg}\n" 0 0
# return error for return to parent menu
return $_err
fi
fi
else
# add $FUNCNAME limit to 20 max for control if recursive
echo -e "$(date +%D\ %T) ${_msg} --${FUNCNAME[*]:1:20}" >> "${LOGFILE}"
((debug)) && _msg="${_msg} --${FUNCNAME[*]:1:20}"
echo -e "$(date +%D\ %T) ${_msg}" >> "${LOGFILE}"
fi
}

Loading…
Cancel
Save