mirror of
https://github.com/RetroDECK/RetroDECK.git
synced 2024-11-25 07:25:38 +00:00
Make writing to log file and showing terminal output depending on logging level
This commit is contained in:
parent
3d19ea6a14
commit
2e1a461855
|
@ -85,14 +85,15 @@ log() {
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Display the message in the terminal
|
if [[ ! $logging_level == "none" ]]; then
|
||||||
echo -e "$colored_message" >&2
|
# Display the message in the terminal
|
||||||
|
echo -e "$colored_message" >&2
|
||||||
|
|
||||||
# Write the log message to the log file
|
# Write the log message to the log file
|
||||||
if [ ! -f "$logfile" ]; then
|
if [ ! -f "$logfile" ]; then
|
||||||
echo "$timestamp [WARN] Log file not found in \"$logfile\", creating it" >&2
|
echo "$timestamp [WARN] Log file not found in \"$logfile\", creating it" >&2
|
||||||
touch "$logfile"
|
touch "$logfile"
|
||||||
|
fi
|
||||||
|
echo "$log_message" >> "$logfile"
|
||||||
fi
|
fi
|
||||||
echo "$log_message" >> "$logfile"
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue