I start a bash shell script via a oneshot unit. I output standard messages currently with

echo $message
echo $message >> $logfile.txt

With this I have output on screen and additionally in a logfile. I don’t know if there is a better way to do that.

This works for standard infos fine. Additionally there must be a way to output also error messages and warnings, since when I look into other services, I see red messages for errors and yellow/orange colored messages for warnings.

How can I do such things with my bash script and output other levels like warnings in yellow and errors in red?