diff options
author | John Klug <john.klug@multitech.com> | 2021-12-09 09:19:20 -0600 |
---|---|---|
committer | John Klug <john.klug@multitech.com> | 2021-12-09 09:19:20 -0600 |
commit | 4785e589af2d54550cbe12500c8f7417a50b09e6 (patch) | |
tree | b5389d0c9eada858e65753b6f017cb436b0625dd | |
parent | 12530cd44f2093b171c73c639527c9e7d6583b33 (diff) | |
download | meta-multitech-atmel-4785e589af2d54550cbe12500c8f7417a50b09e6.tar.gz meta-multitech-atmel-4785e589af2d54550cbe12500c8f7417a50b09e6.tar.bz2 meta-multitech-atmel-4785e589af2d54550cbe12500c8f7417a50b09e6.zip |
Improve logging in /etc/init.d/rs9113
-rwxr-xr-x | recipes-kernel/rs9113/files/rs9113/rs9113.init | 23 |
1 files 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 |