mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-11-05 21:02:11 +08:00
Script Refactoring
This commit is contained in:
parent
e2a9fb104b
commit
f3f2c6a948
@ -262,17 +262,8 @@ function openim::log::print_blue() {
|
|||||||
|
|
||||||
function openim::log::print_red() {
|
function openim::log::print_red() {
|
||||||
local current_time=$(date "+%Y-%m-%d %H:%M:%S %Z")
|
local current_time=$(date "+%Y-%m-%d %H:%M:%S %Z")
|
||||||
local msg_length=${#1}
|
echo -e "[$current_time]"
|
||||||
local time_length=${#current_time}
|
echo -e "\033[0;31m$1\033[0m"
|
||||||
local term_width=$(tput cols)
|
|
||||||
|
|
||||||
local total_length=$((time_length + msg_length + 2))
|
|
||||||
|
|
||||||
if [ $total_length -gt $term_width ]; then
|
|
||||||
echo -e "[$current_time]\n\033[0;31m$1\033[0m"
|
|
||||||
else
|
|
||||||
echo -e "[$current_time] \033[0;31m$1\033[0m"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user