Skip to content

Commit

Permalink
feat(ui): standardize warning logs and add yellow color (#1268)
Browse files Browse the repository at this point in the history
  • Loading branch information
bitcoin-tools authored Aug 17, 2024
1 parent 80346d8 commit c87da1e
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions nodebuilder
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,8 @@ EOF

display_macos_warning() {
if [ "${TARGET_KERNEL}" = 'Darwin' ] && [ "${TARGET_ARCHITECTURE}" = 'arm64' ]; then
printf '%s\n%s\n' \
'WARNING: macOS has an unpatched security vulnerability called GoFetch.' \
' Avoid security-critical actions, such as securing significant funds.'
log_warning 'macOS has an unpatched security vulnerability called GoFetch.'
log_warning 'Avoid security-critical actions, such as securing significant funds.'
if [ "${unattended:-false}" = 'false' ] && ! is_running_in_ci; then
printf '%s' 'PRESS ENTER to continue or press Ctrl+C to exit... '
read -r _
Expand Down Expand Up @@ -804,11 +803,23 @@ is_valid_bitcoin_version() {

log_error() {
printf '\n'
printf '[%s] ERROR: %s' "$(get_log_timestamp)" "${CONSOLE_COLOR_RED}$*" >&2
printf '[%s] ERROR: %s' \
"$(get_log_timestamp)" \
"${CONSOLE_COLOR_RED}$*" \
>&2
reset_console_color
printf '\n' >&2
}

log_warning() {
printf '\n'
printf '[%s] WARN: %s' \
"$(get_log_timestamp)" \
"${CONSOLE_COLOR_YELLOW}$*"
reset_console_color
printf '\n'
}

print_usage() {
printf '%s\n\n' "Usage: $0 [options]"
printf '%s\n' 'Options:'
Expand Down Expand Up @@ -869,6 +880,7 @@ throw_error() {
}

readonly CONSOLE_COLOR_RED="$(tput setaf 1)"
readonly CONSOLE_COLOR_YELLOW="$(tput setaf 3)"
readonly CONSOLE_COLOR_NORMAL="$(tput sgr0)"

# This list excludes vulnerable versions, e.g. CVE-2015-6031 and CVE-2018-17144
Expand Down

0 comments on commit c87da1e

Please sign in to comment.