|
...
|
...
|
@@ -135,12 +135,29 @@ elif [[ -f $RC_DIR/.localrc.auto ]]; then
|
|
135
|
135
|
source $RC_DIR/.localrc.auto
|
|
136
|
136
|
fi
|
|
137
|
137
|
|
|
|
138
|
+# Default for log coloring is based on interactive-or-not.
|
|
|
139
|
+# Baseline assumption is that non-interactive invocations are for CI,
|
|
|
140
|
+# where logs are to be presented as browsable text files; hence color
|
|
|
141
|
+# codes should be omitted.
|
|
|
142
|
+# Simply override LOG_COLOR if your environment is different.
|
|
|
143
|
+if [ -t 1 ]; then
|
|
|
144
|
+ _LOG_COLOR_DEFAULT=True
|
|
|
145
|
+else
|
|
|
146
|
+ _LOG_COLOR_DEFAULT=False
|
|
|
147
|
+fi
|
|
|
148
|
+
|
|
138
|
149
|
# Use color for logging output (only available if syslog is not used)
|
|
139
|
|
-LOG_COLOR=$(trueorfalse True LOG_COLOR)
|
|
|
150
|
+LOG_COLOR=$(trueorfalse $_LOG_COLOR_DEFAULT LOG_COLOR)
|
|
140
|
151
|
|
|
141
|
152
|
# Make tracing more educational
|
|
142
|
153
|
if [[ "$LOG_COLOR" == "True" ]]; then
|
|
143
|
|
- export PS4='+\[$(tput setaf 242)\]$(short_source)\[$(tput sgr0)\] '
|
|
|
154
|
+ # tput requires TERM or -T. If neither is present, use vt100, a
|
|
|
155
|
+ # no-frills least common denominator supported everywhere.
|
|
|
156
|
+ TPUT_T=
|
|
|
157
|
+ if ! [ $TERM ]; then
|
|
|
158
|
+ TPUT_T='-T vt100'
|
|
|
159
|
+ fi
|
|
|
160
|
+ export PS4='+\[$(tput '$TPUT_T' setaf 242)\]$(short_source)\[$(tput '$TPUT_T' sgr0)\] '
|
|
144
|
161
|
else
|
|
145
|
162
|
export PS4='+ $(short_source): '
|
|
146
|
163
|
fi
|