Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use debug logging #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Use debug logging
Switch to debug logging similar to `tfenv`. Having info output each time
`terragrunt` is run can be problematic.
  • Loading branch information
awiddersheim committed Dec 1, 2020
commit c03cfb4087ef7a35f72536aecf0ce843048afbdc
8 changes: 8 additions & 0 deletions libexec/helpers
Original file line number Diff line number Diff line change
@@ -9,6 +9,14 @@ function warn_and_continue() {
echo -e "tgenv: $(basename ${0}): \033[0;33m[WARN] ${1}\033[0;39m" >&2
}

function debug() {
if [ -z "${TGENV_DEBUG}" ]; then
return
fi

echo -e "\033[0;34m[DEBUG] ${1}\033[0;39m"
}

function info() {
echo -e "\033[0;32m[INFO] ${1}\033[0;39m"
}
6 changes: 3 additions & 3 deletions libexec/tgenv-exec
Original file line number Diff line number Diff line change
@@ -17,9 +17,9 @@ set -e
[ -n "${TGENV_DEBUG}" ] && set -x
source "${TGENV_ROOT}/libexec/helpers"

info 'Getting version from tgenv-version-name';
debug 'Getting version from tgenv-version-name';
TGENV_VERSION="$(tgenv-version-name)" \
&& info "TGENV_VERSION is ${TGENV_VERSION}" \
&& debug "TGENV_VERSION is ${TGENV_VERSION}" \
|| {
# Errors will be logged from tgenv-version name,
# we don't need to trouble STDERR with repeat information here
@@ -38,4 +38,4 @@ fi;

TG_BIN_PATH="${TGENV_ROOT}/versions/${TGENV_VERSION}/terragrunt"
export PATH="${TG_BIN_PATH}:${PATH}"
"${TG_BIN_PATH}" "${@}"
"${TG_BIN_PATH}" "${@}"