Update log_warn_die.sh in pt-ioprofile, pt-mysql-summary, and pt-summary.

This commit is contained in:
Daniel Nichter
2013-01-24 11:16:42 -07:00
parent b196f50e60
commit 738359dd10
3 changed files with 42 additions and 15 deletions

View File

@@ -22,23 +22,32 @@ PTFUNCNAME=""
PTDEBUG="${PTDEBUG:-""}"
EXIT_STATUS=0
log() {
TS=$(date +%F-%T | tr ':-' '_');
ts() {
TS=$(date +%F-%T | tr ':-' '_')
echo "$TS $*"
}
info() {
[ ${OPT_VERBOSE:-0} -ge 3 ] && ts "$*"
}
log() {
[ ${OPT_VERBOSE:-0} -ge 2 ] && ts "$*"
}
warn() {
log "$*" >&2
[ ${OPT_VERBOSE:-0} -ge 1 ] && ts "$*" >&2
EXIT_STATUS=1
}
die() {
warn "$*"
ts "$*" >&2
EXIT_STATUS=1
exit 1
}
_d () {
[ "$PTDEBUG" ] && echo "# $PTFUNCNAME: $(log "$*")" >&2
[ "$PTDEBUG" ] && echo "# $PTFUNCNAME: $(ts "$*")" >&2
}
# ###########################################################################