+# Internal function for debug output. {{{
+_autoenv_debug() {
+ local msg=$1
+ local level=${2:-1}
+ if [[ $AUTOENV_DEBUG -lt $level ]]; then
+ return
+ fi
+ # Load zsh color support.
+ if [[ -z $colors ]]; then
+ autoload colors
+ colors
+ fi
+ # Build $indent prefix.
+ local indent=
+ if [[ $_autoenv_debug_indent -gt 0 ]]; then
+ for i in {1..${_autoenv_debug_indent}}; do
+ indent=" $indent"
+ done
+ fi
+
+ # Split $msg by \n (not newline).
+ lines=(${(ps:\\n:)msg})
+ for line in $lines; do
+ echo -n "${fg_bold[blue]}[autoenv]${fg_no_bold[default]} " >&2
+ echo ${indent}${line} >&2
+ done
+}
+# }}}
+