Skip to content

Conversation

@iptoux
Copy link
Owner

@iptoux iptoux commented Dec 15, 2022

Done

iptoux@2040:~/gits/bash_error_lib$ ./basherr.sh
iptoux@2040:~/gits/bash_error_lib$ cat 12.15.22_1835637.log 
- [T]: 22:38:47 [F]: basherr.sh [M]:  [L]: 26 [C]: trap 'bs_error "$?" "${FUNCNAME[0]}"' ERR
- [T]: 22:38:47 [F]: basherr.sh [M]:  [L]: 27 [C]: trap 'bs_error "$?" "${FUNCNAME[0]}"' EXIT
- [T]: 22:38:47 [F]: basherr.sh [M]:  [L]: 28 [C]: trap bs_clean EXIT
- [T]: 22:38:47 [F]: basherr.sh [M]:  [L]: 42 [C]: bs_debug false
- [T]: 22:38:47 [F]: bash_error_lib [M]: bs_debug [L]: 176 [C]: switch=false
- [T]: 22:38:47 [F]: bash_error_lib [M]: bs_debug [L]: 178 [C]: '[' false == auto ']'
- [T]: 22:38:47 [F]: bash_error_lib [M]: bs_debug [L]: 178 [C]: '[' false == true ']'
- [T]: 22:38:47 [F]: bash_error_lib [M]: bs_debug [L]: 187 [C]: '[' false == false ']'
- [T]: 22:38:47 [F]: bash_error_lib [M]: bs_debug [L]: 188 [C]: set +o xtrace
iptoux@2040:~/gits/bash_error_lib$ 

How it works

the library lookup if an argument is given when script is called on cli, like ./basherr.sh -d. If not, you can enable/disable it on any line in your script by calling bs_debug (bool).

An example can be found in source of ./basherr.sh in git repo. The function will create a new log for every runtime, so you can easily debug between edits.

@iptoux iptoux linked an issue Dec 15, 2022 that may be closed by this pull request
@iptoux iptoux self-assigned this Dec 15, 2022
@iptoux iptoux added feature Somthing interesting done labels Dec 15, 2022
@iptoux iptoux added this to the v1.5.0 milestone Dec 15, 2022
@iptoux
Copy link
Owner Author

iptoux commented Dec 15, 2022

There is more?

  • Also updated the README.md

@iptoux iptoux merged commit 6b48f5d into main Dec 15, 2022
@iptoux iptoux deleted the 2-debug-output branch December 15, 2022 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

done feature Somthing interesting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Debug output

2 participants