From 4436d388b39e036ba46d4a1cf727a0b58d730d62 Mon Sep 17 00:00:00 2001 From: skiffer-git <44203734@qq.com> Date: Tue, 2 Apr 2024 17:01:33 +0800 Subject: [PATCH] Script Refactoring --- scripts-new/check.sh | 2 +- scripts-new/lib/logging.sh | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts-new/check.sh b/scripts-new/check.sh index 383cd8c22..5493fb914 100644 --- a/scripts-new/check.sh +++ b/scripts-new/check.sh @@ -32,7 +32,7 @@ source "$OPENIM_SCRIPTS/bricks.sh" result=$(check_binaries_running) ret_val=$? if [ $ret_val -eq 0 ]; then - echo "All services are running normally." + openim::log::print_green "All services are running normally." else openim::log::print_red "Some services are not running as expected. Details are as follows:" openim::log::print_red "$result" diff --git a/scripts-new/lib/logging.sh b/scripts-new/lib/logging.sh index 51e2e20b1..ffde53d85 100644 --- a/scripts-new/lib/logging.sh +++ b/scripts-new/lib/logging.sh @@ -273,6 +273,11 @@ function openim::log::print_green_two_line() { echo -e "\033[0;32m$1\033[0m" } +function openim::log::print_green() { + local current_time=$(date "+%Y-%m-%d %H:%M:%S %Z") + echo -e "[$current_time] \033[0;32m$1\033[0m" +} + function openim::log::print_red() { local current_time=$(date "+%Y-%m-%d %H:%M:%S %Z")