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

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

View File

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

View File

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