Skip to content

Commit

Permalink
upgrade-2.x: identify log messages with script name
Browse files Browse the repository at this point in the history
Change-type: patch
Signed-off-by: Alex Gonzalez <alexg@balena.io>
  • Loading branch information
alexgg committed Apr 25, 2024
1 parent 870e4e9 commit 488ce76
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions upgrade-2.x.sh
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,14 @@ function log {
loglevel=INFO
;;
esac
echo "${1}" | systemd-cat --level-prefix=0 --identifier="$(basename "$0")" --priority="${priority}" 2> /dev/null || true
echo "${1}" | systemd-cat --level-prefix=0 --identifier="${SCRIPTNAME}" --priority="${priority}" 2> /dev/null || true
endtime=$(date +%s)
if [ "$loglevel" == "ERROR" ]; then
printf "[%09d%s%s\n" "$((endtime - starttime))" "][$loglevel]" "$1" >> /dev/stderr
printf "[$SCRIPTNAME][%09d%s%s\n" "$((endtime - starttime))" "][$loglevel]" "$1" >> /dev/stderr
report_update_failed
exit 1
else
printf "[%09d%s%s\n" "$((endtime - starttime))" "][$loglevel]" "$1"
printf "[$SCRIPTNAME][%09d%s%s\n" "$((endtime - starttime))" "][$loglevel]" "$1"
fi
}

Expand Down

0 comments on commit 488ce76

Please sign in to comment.