Add a verbosity concept to kubernetes scripts

The KUBE_VERBOSE environment variable sets the verbosity level to
use. Log messages can specify a verbosity by setting the V
variable. e.g.

    V=2 kube::log::info foo bar

Would only print "foo bar" if $KUBE_VERBOSE >= 2.
This commit is contained in:
Tim St. Clair
2016-08-04 17:35:26 -07:00
parent 07b650e165
commit 9abdf719b8
7 changed files with 35 additions and 12 deletions

View File

@@ -23,6 +23,8 @@ if [[ -z "${KUBE_ROOT:-}" ]]; then
KUBE_ROOT="../../../"
fi
source "${KUBE_ROOT}/cluster/lib/logging.sh"
if [[ ! -d "${KUBE_ROOT}/examples" ]]; then
echo "${KUBE_ROOT}/examples not detected. This script should be run from a location where the source dirs are available."
exit 1
@@ -44,4 +46,4 @@ go-bindata -nometadata -prefix "${KUBE_ROOT}" -o ${BINDATA_OUTPUT} -pkg generate
gofmt -s -w ${BINDATA_OUTPUT}
echo "Generated bindata file : $(wc -l ${BINDATA_OUTPUT}) lines of lovely automated artifacts"
V=2 kube::log::info "Generated bindata file : $(wc -l ${BINDATA_OUTPUT}) lines of lovely automated artifacts"