1.1 --- a/scripts/functions Sat Feb 24 11:00:05 2007 +0000
1.2 +++ b/scripts/functions Tue May 01 09:10:31 2007 +0000
1.3 @@ -59,14 +59,13 @@
1.4 # Usage: CT_DoLog <level> [message]
1.5 # If message is empty, then stdin will be logged.
1.6 CT_DoLog() {
1.7 - local max_level
1.8 - local level
1.9 + local max_level LEVEL level cur_l cur_L
1.10 + local l
1.11 eval max_level="\${CT_LOG_LEVEL_${CT_LOG_LEVEL_MAX}}"
1.12 # Set the maximum log level to DEBUG if we have none
1.13 [ -z ${max_level} ] && max_level=${CT_LOG_LEVEL_DEBUG}
1.14
1.15 - local LEVEL="$1"
1.16 - shift
1.17 + LEVEL="$1"; shift
1.18 eval level="\${CT_LOG_LEVEL_${LEVEL}}"
1.19
1.20 if [ $# -eq 0 ]; then
1.21 @@ -77,12 +76,18 @@
1.22 cpt=0
1.23 indent=$((2*CT_STEP_COUNT))
1.24 while read line; do
1.25 - l="`printf \"[%-5s]%*s%s%s\" \"${LEVEL}\" \"${indent}\" \" \" \"${line}\"`"
1.26 + case "${CT_LOG_SEE_TOOLS_WARN},${line}" in
1.27 + y,*"warning:"*) cur_L=WARN; cur_l=${CT_LOG_LEVEL_WARN};;
1.28 + *"error:"*) cur_L=ERROR; cur_l=${CT_LOG_LEVEL_ERROR};;
1.29 + "make["?*"]:"*"Stop.") cur_L=ERROR; cur_l=${CT_LOG_LEVEL_ERROR};;
1.30 + *) cur_L="${LEVEL}"; cur_l="${level}";;
1.31 + esac
1.32 + l="`printf \"[%-5s]%*s%s%s\" \"${cur_L}\" \"${indent}\" \" \" \"${line}\"`"
1.33 # There will always be a log file, be it /dev/null
1.34 echo -e "${l}" >>"${CT_ACTUAL_LOG_FILE}"
1.35 - color="CT_${LEVEL}_COLOR"
1.36 + color="CT_${cur_L}_COLOR"
1.37 normal="CT_NORMAL_COLOR"
1.38 - if [ ${level} -le ${max_level} ]; then
1.39 + if [ ${cur_l} -le ${max_level} ]; then
1.40 echo -e "${!color}${l}${!normal}"
1.41 else
1.42 ${CT_PROG_BAR}