summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--etc/build.theme60
-rw-r--r--subr.rtl/rtl_log.subr54
2 files changed, 89 insertions, 25 deletions
diff --git a/etc/build.theme b/etc/build.theme
index cc5d83f1..d472e2cd 100644
--- a/etc/build.theme
+++ b/etc/build.theme
@@ -42,42 +42,60 @@ LOG_TAGS_verbose="${LOG_TAGS_normal:+${LOG_TAGS_normal},}zipdist,verbose,build_v
#
# Subsystem tags
#
-LOG_TAG_build=""; # (UNUSED)
-LOG_TAG_fileop=36; # Cyan
-LOG_TAG_install=36; # Cyan
-LOG_TAG_zipdist=93; # Bright yellow
-LOG_TAG_xtrace=""; # (UNUSED)
+LOG_TAG_build=""; # (UNUSED)
+LOG_TAG_fileop=36; # Cyan
+LOG_TAG_install=36; # Cyan
+LOG_TAG_zipdist=93; # Bright yellow
+LOG_TAG_xtrace=""; # (UNUSED)
#
# General level tags
#
-LOG_TAG_fatal=91; # Bright red
-LOG_TAG_info=93; # Bright yellow
-LOG_TAG_verbose=96; # Bright cyan
-LOG_TAG_warning=31; # Dark red
+LOG_TAG_fatal=91; # Bright red
+LOG_TAG_info=93; # Bright yellow
+LOG_TAG_verbose=96; # Bright cyan
+LOG_TAG_warning=31; # Dark red
#
# General build tags
#
-LOG_TAG_build_begin="4;93"; # Underline; Bright yellow
-LOG_TAG_build_finish="4;93"; # Underline; Bright yellow
-LOG_TAG_build_finish_time="4;93"; # Underline; Bright yellow
-LOG_TAG_build_vars="33"; # Dark yellow
+LOG_TAG_build_begin="4;93"; # Underline; Bright yellow
+LOG_TAG_build_finish="4;93"; # Underline; Bright yellow
+LOG_TAG_build_finish_time="4;93"; # Underline; Bright yellow
+LOG_TAG_build_vars="33"; # Dark yellow
+LOG_TAG_build_vars_even_256="38;5;215"; # RGB #ffaf5f
+LOG_TAG_build_vars_odd_256="38;5;214"; # RGB #ffaf00
#
# Build group tags
#
-LOG_TAG_group_begin="4;93"; # Underline; Bright yellow
-LOG_TAG_group_finish="4;92"; # Underline; Bright green
+LOG_TAG_group_begin="4;93"; # Underline; Bright yellow
+LOG_TAG_group_begin_even_256="4;38;5;228"; # Underline; RGB #ffff87
+LOG_TAG_group_begin_odd_256="4;38;5;226"; # Underline; RGB #ffff00
+LOG_TAG_group_finish="4;92"; # Underline; Bright green
+LOG_TAG_group_finish_even_256="4;38;5;121"; # Underline; RGB #87ffaf
+LOG_TAG_group_finish_odd_256="4;38;5;118"; # Underline; RGB #87ff00
#
# Package build tags
#
-LOG_TAG_pkg_begin=93; # Bright yellow
-LOG_TAG_pkg_finish=92; # Bright green
-LOG_TAG_pkg_msg=90; # Dark grey
-LOG_TAG_pkg_skip=36; # Cyan
-LOG_TAG_pkg_step=90; # Dark grey
-LOG_TAG_pkg_strip=93; # Bright yellow
+LOG_TAG_pkg_begin_even=93; # Bright yellow
+LOG_TAG_pkg_begin_odd=93; # Bright yellow
+LOG_TAG_pkg_begin_even_256="38;5;220"; # RGB #ffd700
+LOG_TAG_pkg_begin_odd_256="38;5;214"; # RGB #ffaf00
+LOG_TAG_pkg_finish_even=92; # Bright green
+LOG_TAG_pkg_finish_odd=92; # Bright green
+LOG_TAG_pkg_finish_even_256="38;5;154"; # RGB #afff00
+LOG_TAG_pkg_finish_odd_256="38;5;148"; # RGB #afd700
+LOG_TAG_pkg_msg=90; # Dark grey
+LOG_TAG_pkg_skip_even=36; # Cyan
+LOG_TAG_pkg_skip_odd=36; # Cyan
+LOG_TAG_pkg_skip_even_256="38;5;117"; # RGB #87d7ff
+LOG_TAG_pkg_skip_odd_256="38;5;123"; # RGB #87ffff
+LOG_TAG_pkg_step_even=90; # Dark grey
+LOG_TAG_pkg_step_odd=90; # Dark grey
+LOG_TAG_pkg_step_even_256="38;5;242"; # RGB #6c6c6c
+LOG_TAG_pkg_step_odd_256="38;5;240"; # RGB #585858
+LOG_TAG_pkg_strip=93; # Bright yellow
# vim:foldmethod=marker ft=sh
diff --git a/subr.rtl/rtl_log.subr b/subr.rtl/rtl_log.subr
index 57e2ebfd..1254916a 100644
--- a/subr.rtl/rtl_log.subr
+++ b/subr.rtl/rtl_log.subr
@@ -4,12 +4,58 @@
#
#
-# Private globals and subroutines
+# Private globals
#
RTLP_LOG_FNAME="";
RTLP_LOG_NO_ATTR=0;
RTLP_LOG_TAGS="";
+RTLP_LOG_TERMINAL_COLOURS="$(tput colors 2>/dev/null)";
+
+#
+# Private subroutines
+#
+
+rtlp_log_msg_get_attr() {
+ local _rplmga_rattr="${1#\$}" _rplmga_tag="${2}" \
+ _rplmga_attr="" _rplmga_attr_state="" \
+ _rplmga_term_colour=0;
+
+ if [ "${RTLP_LOG_TERMINAL_COLOURS}" = 256 ]; then
+ set -- 256 "";
+ else
+ set -- "";
+ fi;
+
+ for _rplmga_term_colour in "${@}"; do
+ eval _rplmga_attr='${LOG_TAG_'"${_rplmga_tag}${_rplmga_term_colour:+_${_rplmga_term_colour}}"':-}';
+
+ if [ "${_rplmga_attr:+1}" = 1 ]; then
+ break;
+ else
+ eval _rplmga_attr_state='${RTLP_ATTR_STATE_'"${_rplmga_tag}"':-}';
+ if [ "${_rplmga_attr_state:+1}" != 1 ]; then
+ _rplmga_attr_state=0;
+ else
+ : $((_rplmga_attr_state += 1));
+ fi;
+ eval "RTLP_ATTR_STATE_${_rplmga_tag}=${_rplmga_attr_state}";
+
+ if [ "$((${_rplmga_attr_state} % 2))" -eq 0 ]; then
+ eval _rplmga_attr='${LOG_TAG_'"${_rplmga_tag}"'_even'"${_rplmga_term_colour:+_${_rplmga_term_colour}}"':-}';
+ else
+ eval _rplmga_attr='${LOG_TAG_'"${_rplmga_tag}"'_odd'"${_rplmga_term_colour:+_${_rplmga_term_colour}}"':-}';
+ fi;
+
+ if [ "${_rplmga_attr:+1}" = 1 ]; then
+ break;
+ fi;
+ fi;
+ done;
+
+ eval ${_rplmga_rattr}='${_rplmga_attr}';
+ return 0;
+};
rtlp_log_printf() {
local _rplp_attr="${1}" _rplp_fmt_pfx="${2}" \
@@ -75,7 +121,7 @@ rtl_log_env_vars() {
rtl_log_msg() {
local _rlm3_tag="${1}" _rlm3_fmt="${2}" \
- _rlm3_attr="" _rlm3_date_now=0 _rlm3_exitfl=0;
+ _rlm3_attr="" _rlm3_date_now=0 _rlm3_exitfl=0
shift 2;
if [ "x${_rlm3_tag}" = "xfatalexit" ]; then
@@ -85,8 +131,8 @@ rtl_log_msg() {
if [ "${_rlm3_tag}" = "fatal" ]\
|| rtl_lmatch \$RTLP_LOG_TAGS "${_rlm3_tag}" ",";
then
- eval _rlm3_attr='${LOG_TAG_'"${_rlm3_tag}"':-}';
- if [ "${#_rlm3_attr}" -eq 0 ]; then
+ rtlp_log_msg_get_attr \$_rlm3_attr "${_rlm3_tag}";
+ if [ "${_rlm3_attr:+1}" != 1 ]; then
rtlp_log_printf "" "" "0;==> FIXME TODO XXX UNKNOWN TAG \`${_rlm3_tag}' PASSED TO rtl_log_msg()\n";
fi;
rtl_date \$_rlm3_date_now;