feat: fix openim logs and ci (#1878)

pull/1883/head
Xinwei Xiong 10 months ago committed by GitHub
parent 9610da9123
commit 311d42283b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -131,16 +131,24 @@ openim::log::error_exit() {
exit "${code}" exit "${code}"
} }
# Log an error but keep going. Don't dump the stack or exit. # Log an error but keep going. Don't dump the stack or exit.
openim::log::error() { openim::log::error() {
# Define red color
red='\033[0;31m'
# No color (reset)
nc='\033[0m' # No Color
timestamp=$(date +"[%Y-%m-%d %H:%M:%S %Z]") timestamp=$(date +"[%Y-%m-%d %H:%M:%S %Z]")
echo_log "!!! ${timestamp} ${1-}" >&2 # Apply red color for error message
echo_log "${red}!!! ${timestamp} ${1-}${nc}" >&2
shift shift
for message; do for message; do
echo_log " ${message}" >&2 # Apply red color for subsequent lines of the error message
echo_log "${red} ${message}${nc}" >&2
done done
} }
# Print an usage message to stderr. The arguments are printed directly. # Print an usage message to stderr. The arguments are printed directly.
openim::log::usage() { openim::log::usage() {
echo_log >&2 echo_log >&2

@ -1541,12 +1541,8 @@ openim::util::check_ports() {
if [[ "$OSTYPE" == "linux-gnu"* ]]; then if [[ "$OSTYPE" == "linux-gnu"* ]]; then
if command -v ss > /dev/null 2>&1; then if command -v ss > /dev/null 2>&1; then
info=$(ss -ltnp | grep ":$port" || true) info=$(ss -ltnp | grep ":$port" || true)
openim::color::echo $COLOR_RED "!!!!!!!! port=$port"
openim::color::echo $COLOR_RED "!!!!!!!! info=$info"
else else
info=$(netstat -ltnp | grep ":$port" || true) info=$(netstat -ltnp | grep ":$port" || true)
openim::color::echo $COLOR_RED "!!!!!!!! port=$port"
openim::color::echo $COLOR_RED "!!!!!!!! info=$info"
fi fi
elif [[ "$OSTYPE" == "darwin"* ]]; then elif [[ "$OSTYPE" == "darwin"* ]]; then
# For macOS, use lsof # For macOS, use lsof

@ -82,4 +82,4 @@ execute_scripts
openim::log::info "\n## Post Starting OpenIM services" openim::log::info "\n## Post Starting OpenIM services"
${TOOLS_START_SCRIPTS_PATH} openim::tools::post-start ${TOOLS_START_SCRIPTS_PATH} openim::tools::post-start
openim::log::success "✨ All OpenIM services have been successfully started!" openim::color::echo $COLOR_BLUE "✨ All OpenIM services have been successfully started!"
Loading…
Cancel
Save