armbian-next: hopefully improved error logging; avoid logging errors up to 3x; subdued red stacktraces

- reorg `display_alert()` so more frequent levels are handled first
- improve some ANSI color usage, still a mess
- don't write failed commands stackstrace as warnings to screen -- just to file (yes it's redundant, except if in test)
- more useful / subdued stacktraces, to make actual error more obvious...
This commit is contained in:
Ricardo Pardini
2023-01-18 22:43:25 +01:00
parent da1cf2b475
commit 8cedc82ec2
6 changed files with 74 additions and 58 deletions

View File

@@ -52,10 +52,10 @@ function export_ansi_logs() {
dim_line_separator=$(echo -e -n "${gray_color:-}")------------------------------------------------------------------------------------------------------------$(echo -e -n "${normal_color:-}")
cat <<- ANSI_HEADER > "${target_file}"
# Armbian logs for ${ARMBIAN_BUILD_UUID}
# Armbian build at $(LC_ALL=C LANG=C date) on $(hostname || true)
# Armbian ANSI build logs for ${ARMBIAN_BUILD_UUID} - use "less -SR" to view
$(echo -e -n "${bright_blue_color}")# Armbian build at $(LC_ALL=C LANG=C date) on $(hostname || true)
${dim_line_separator}
# ARGs: ${ARMBIAN_ORIGINAL_ARGV[@]@Q}
$(echo -e -n "${bright_blue_color}")# ARGs: ${ARMBIAN_ORIGINAL_ARGV[@]@Q}
${dim_line_separator}
ANSI_HEADER
@@ -95,7 +95,7 @@ function export_ansi_logs() {
logfile_title="$(echo "${logfile_base}" | sed -e 's/^[^.]*\.[^.]*\.//')"
cat <<- ANSI_ONE_LOGFILE >> "${target_file}"
$(echo -e -n "\033[94m")### ${logfile_title} $(echo -e -n "${normal_color}")
$(echo -e -n "${bright_blue_color}")### ${logfile_title} $(echo -e -n "${normal_color}")
$(cat "${logfile_full}" | sed -e "${prefix_sed_cmd}")
${dim_line_separator}
ANSI_ONE_LOGFILE
@@ -107,6 +107,6 @@ function export_ansi_logs() {
if [[ "${show_message_after_export:-"yes"}" != "skip" ]]; then
display_alert "ANSI log file built; inspect it by running:" "less -RS ${target_relative_to_src}"
fi
return 0
}