diff --git a/bin/pt-ioprofile b/bin/pt-ioprofile index 5f4a0c57..91f1de08 100755 --- a/bin/pt-ioprofile +++ b/bin/pt-ioprofile @@ -20,23 +20,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 } # ########################################################################### diff --git a/bin/pt-mysql-summary b/bin/pt-mysql-summary index f5a40676..0c5352d4 100755 --- a/bin/pt-mysql-summary +++ b/bin/pt-mysql-summary @@ -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 } # ########################################################################### diff --git a/bin/pt-summary b/bin/pt-summary index 4c4ac007..1cfcbfc1 100755 --- a/bin/pt-summary +++ b/bin/pt-summary @@ -29,23 +29,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 } # ###########################################################################