2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-22 11:42:05 +00:00

30 lines
617 B
Plaintext

declare -F msgutil_r &>/dev/null || function msgutil_r {
local logserver=$1
local msgtype=$2
local msgstr=$3
local logfile=$4
if [ -z "$msgtype" ]; then
msgtype="debug"
fi
logger -n $logserver -t xcat -p local4.$msgtype "$msgstr"
if [ -n "$logfile" ]; then
local logdir="$(dirname $logfile)"
if [ ! -d "$logdir" ]; then
mkdir -p "$logdir"
touch "$logfile"
fi
# echo "$msgstr" | tee -a $logfile
#else
echo "$msgstr" >> $logfile
fi
}
declare -F msgutil &>/dev/null || function msgutil {
msgutil_r "localhost" "$@"
}