Skip to content

Commit

Permalink
Improve debug mode (kvz#103)
Browse files Browse the repository at this point in the history
Add file, line number, function name and function line offset
  • Loading branch information
QwertyZW authored and kvz committed May 6, 2019
1 parent ba0e715 commit 7b7d31a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ __b3bp_err_report() {
# debug mode
if [[ "${arg_d:?}" = "1" ]]; then
set -o xtrace
PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
LOG_LEVEL="7"
# Enable error backtracing
trap '__b3bp_err_report "${FUNCNAME:-.}" ${LINENO}' ERR
Expand Down
1 change: 1 addition & 0 deletions main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ __b3bp_err_report() {
# debug mode
if [[ "${arg_d:?}" = "1" ]]; then
set -o xtrace
PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
LOG_LEVEL="7"
# Enable error backtracing
trap '__b3bp_err_report "${FUNCNAME:-.}" ${LINENO}' ERR
Expand Down

0 comments on commit 7b7d31a

Please sign in to comment.