autobuild3
autobuild3 copied to clipboard
libbase/ab{die,warn,err,info,...}: Use BASH_SOURCE & BASH_LINENO in err msgs
Expected output:
[WARN] foo/bar.sh:233: blah.
Extra points for abdie: backtrace.
Crappy things:
-
.
will introduce an extra level of func call.-
recsr
gives you two, but that is acceptable.
-
Alternative solutions:
_abdie(){ ...:$errline: }
alias abdie='errline=$LINENO _abdie'
This will result in some by-func-or-by-script addressing. When you get source
from FUNCNAME[0]
, you should look at BASH_SOURCE
instead.