diff -r f67b52e42fd1 -r aa1a9fbd6eb8 scripts/functions --- a/scripts/functions Sun May 13 19:03:49 2007 +0000 +++ b/scripts/functions Thu May 17 16:22:51 2007 +0000 @@ -13,6 +13,8 @@ CT_DoLog ERROR " called from \"${BASH_SOURCE[${depth}]}\" at line # ${BASH_LINENO[${depth}-1]} in function \"${FUNCNAME[${depth}]}\"" done CT_DoLog ERROR "Look at \"${CT_ACTUAL_LOG_FILE}\" for more info on this error." + CT_STEP_COUNT=1 + CT_DoEnd ERROR exit $ret } trap CT_OnError ERR @@ -28,25 +30,6 @@ CT_LOG_LEVEL_DEBUG=4 CT_LOG_LEVEL_ALL=5 -# Attributes -_A_NOR="\\033[0m" -_A_BRI="\\033[1m" -_A_DIM="\\033[2m" -_A_UND="\\033[4m" -_A_BRB="\\033[5m" -_A_REV="\\033[7m" -_A_HID="\\033[8m" - -# Fore colors -_F_BLK="\\033[30m" -_F_RED="\\033[31m" -_F_GRN="\\033[32m" -_F_YEL="\\033[33m" -_F_BLU="\\033[34m" -_F_MAG="\\033[35m" -_F_CYA="\\033[36m" -_F_WHI="\\033[37m" - # A function to log what is happening # Different log level are available: # - ERROR: A serious, fatal error occurred @@ -84,10 +67,8 @@ l="`printf \"[%-5s]%*s%s%s\" \"${cur_L}\" \"${indent}\" \" \" \"${line}\"`" # There will always be a log file, be it /dev/null echo -e "${l}" >>"${CT_ACTUAL_LOG_FILE}" - color="CT_${cur_L}_COLOR" - normal="CT_NORMAL_COLOR" if [ ${cur_l} -le ${max_level} ]; then - echo -e "\r${!color}${l}${!normal}" + echo -e "\r${l}" fi if [ "${CT_LOG_PROGRESS_BAR}" = "y" ]; then str=`CT_DoDate +%s` @@ -105,7 +86,21 @@ return 0 } -# Abort the execution with a error message +# Tail message to be logged whatever happens +# Usage: CT_DoEnd +CT_DoEnd() +{ + CT_STOP_DATE=`CT_DoDate +%s%N` + CT_STOP_DATE_HUMAN=`CT_DoDate +%Y%m%d.%H%M%S` + CT_DoLog INFO "Build completed at ${CT_STOP_DATE_HUMAN}" + elapsed=$((CT_STOP_DATE-CT_STAR_DATE)) + elapsed_min=$((elapsed/(60*1000*1000*1000))) + elapsed_sec=`printf "%02d" $(((elapsed%(60*1000*1000*1000))/(1000*1000*1000)))` + elapsed_csec=`printf "%02d" $(((elapsed%(1000*1000*1000))/(10*1000*1000)))` + CT_DoLog INFO "(elapsed: ${elapsed_min}:${elapsed_sec}.${elapsed_csec})" +} + +# Abort the execution with an error message # Usage: CT_Abort CT_Abort() { CT_DoLog ERROR "$1" >&2