make log output to stderr

This commit is contained in:
Alex Meyer 2024-05-14 16:16:36 -04:00
parent 15657f396c
commit 5db5fcb407
2 changed files with 3 additions and 3 deletions

View file

@ -34,7 +34,7 @@ find_compatible_compression_format() {
local normalized_filename=$(echo "$1" | tr '[:upper:]' '[:lower:]') local normalized_filename=$(echo "$1" | tr '[:upper:]' '[:lower:]')
local system=$(echo "$1" | grep -oE "$roms_folder/[^/]+" | grep -oE "[^/]+$") local system=$(echo "$1" | grep -oE "$roms_folder/[^/]+" | grep -oE "[^/]+$")
if [[ $(validate_for_chd "$1") == *"true" ]] && [[ $(sed -n '/^\[/{h;d};/\b'"$system"'\b/{g;s/\[\(.*\)\]/\1/p;q};' $compression_targets) == "chd" ]]; then if [[ $(validate_for_chd "$1") == "true" ]] && [[ $(sed -n '/^\[/{h;d};/\b'"$system"'\b/{g;s/\[\(.*\)\]/\1/p;q};' $compression_targets) == "chd" ]]; then
echo "chd" echo "chd"
elif grep -qF ".${normalized_filename##*.}" $zip_compressable_extensions && [[ $(sed -n '/^\[/{h;d};/\b'"$system"'\b/{g;s/\[\(.*\)\]/\1/p;q};' $compression_targets) == "zip" ]]; then elif grep -qF ".${normalized_filename##*.}" $zip_compressable_extensions && [[ $(sed -n '/^\[/{h;d};/\b'"$system"'\b/{g;s/\[\(.*\)\]/\1/p;q};' $compression_targets) == "zip" ]]; then
echo "zip" echo "zip"

View file

@ -86,11 +86,11 @@ log() {
esac esac
# Display the message in the terminal # Display the message in the terminal
echo -e "$colored_message" 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" echo "$timestamp [WARN] Log file not found in \"$logfile\", creating it" >&2
touch "$logfile" touch "$logfile"
fi fi
echo "$log_message" >> "$logfile" echo "$log_message" >> "$logfile"