From e45e5c5ef5eb49ffb6f6eb27174bbe87cc424a46 Mon Sep 17 00:00:00 2001 From: John Klug Date: Thu, 9 Dec 2021 09:19:20 -0600 Subject: Improve logging in /etc/init.d/rs9113 --- recipes-kernel/rs9113/files/rs9113/rs9113.init | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/recipes-kernel/rs9113/files/rs9113/rs9113.init b/recipes-kernel/rs9113/files/rs9113/rs9113.init index ced9e35..5a5ed47 100755 --- a/recipes-kernel/rs9113/files/rs9113/rs9113.init +++ b/recipes-kernel/rs9113/files/rs9113/rs9113.init @@ -25,22 +25,23 @@ RSTLOG=/var/config/rs9113rstlog pid=$$ LOG_ERR=3 LOG_INFO=6 - -prefix="<${pr}>rs9113[${pid}]: " +name=rs9113 +format="%s[%d] %12.2fs: %s" +prefix1="<${pr}>rs9113[${pid}]: " +prefix2="rs9113[${pid}]: " function syslog { pr=$1 shift - [[ $(cat /proc/uptime =~ ([^[:space:]]+) ]] - s=$(printf "%12.12fs %s" ${BASH_REMATCH[1]} "${prefix}$@") - echo "$s" >/dev/kmsg - echo "$s" + [[ $(cat /proc/uptime) =~ ([^[:space:]]+) ]] + s=$(printf "${format}" $name $pid ${BASH_REMATCH[1]} "$@") + echo "<${pr}>${s}" >/dev/kmsg echo "$s" >>${RSTLOG} } function logfile { - [[ $(cat /proc/uptime =~ ([^[:space:]]+) ]] - s=$(printf "%12.12fs %s" ${BASH_REMATCH[1]} "${prefix}$@") - echo "$s" >${RSTLOG} + [[ $(cat /proc/uptime) =~ ([^[:space:]]+) ]] + s=$(printf "${format}" $pr $name $pid ${BASH_REMATCH[1]} "$@") + echo "$s" >>${RSTLOG} } function logpipe { @@ -92,7 +93,7 @@ case "$1" in exit 0 fi rs9113_reset - syslog LOG_INFO "Loading rs9113 modules with COEX=$COEX_MODE and Country=$SET_COUNTRY_CODE" + syslog $LOG_INFO "Loading rs9113 modules with COEX=$COEX_MODE and Country=$SET_COUNTRY_CODE" /usr/sbin/rs9113_load_modules.sh $CONFIG RETVAL=$? if [ $RETVAL -eq 0 ] ; then @@ -103,7 +104,7 @@ case "$1" in ;; stop) - syslog LOG_INFO "Unloading rs9113 modules" + syslog $LOG_INFO "Unloading rs9113 modules" /usr/sbin/rs9113_remove_modules.sh RETVAL=$? if [ $RETVAL -eq 0 ] ; then -- cgit v1.2.3